Difference between static and relative positioning

后端 未结 8 1323
野性不改
野性不改 2020-11-27 11:09

In CSS, what is the difference between static (default) positioning and relative positioning?

8条回答
  •  Happy的楠姐
    2020-11-27 11:43

    Matthew Abbott has a really good answer.

    Absolute and relative positioned items obey top, left, right and bottom commands (offsets) where static positioned items do not.

    Relatively positioned items move offsets from where they would normally be in the html.

    Absolute positioned items move offsets from the document or the next relatively positioned element up the DOM tree.

提交回复
热议问题