left
position values are determined from the specified left value and place the width to the right of that point.
right
position values are calculated based on the specified right value and position the width to the left of the location.
You can visually observe this in your example, where the right side of the top 100 aligns with the left side of the bottom one.
This logic is important. For instance, if left:0
and right:0
were deemed equivalent, the left
version would be on the far left with full width visible, while the right
version would be at the far right and out of view. Instead, it correctly displays the element with its complete width towards the right-most edge.
In truth, both values are slightly incorrect because left
and right
consider the width of the element being positioned. To ensure accuracy, you should include a negative margin on one side equal to half the width of the element. This error becomes evident when assigning a left value of 100%
, causing the marker to exceed the intended range.