Absolute positioning with percentages giving unexpected results

前端 未结 3 523

Please consider this jsfiddle, containing this html code:

TEST

A

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-05 10:27

    When giving an element absolute position you take it out of the normal flow of the document. Absolute is the very upper left portion of the screen regardless of the other elements in the page. So by saying left: 50% you're saying half way in from the absolute left of the screen.

提交回复
热议问题