Relatively position an element without it taking up space in document flow

后端 未结 6 1074
迷失自我
迷失自我 2020-12-04 06:02

How can I relatively position an element, and have it not take up space in the document flow?

6条回答
  •  难免孤独
    2020-12-04 06:26

    You simply take that element off the document flow by setting position: absolute, and leave it's breaking point move freely with the dynamic flow of content by not specifying the left top right and bottom style properties which will be forcing it to use the relative endpoint of the flow dynamically. This way the absolutely positioned element will follow the document flow while removing itself from taking up the space.

    No dummy wrappers are needed.

提交回复
热议问题