This is the right behavior. If you set left:100% in this setup, it will take the width of the parent and pushes the child 100% of that width to the right, which is 500px. You can, as already mentioned, set a negative margin width fixed pixel values, but i wouldn't recommend it. What if you have a fluid width layout? It won't work.
What's wrong with right: 0
, it provides exactly what you are looking for.
Otherwise, if you still want to work with left: 100%;
you can add transform: translateX(-100%)
to the child. this will move the child on the X-axis by it's width.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…