Is there anything wrong with positioning all elements relatively?

后端 未结 4 1079
天命终不由人
天命终不由人 2020-12-16 06:35

Often I find myself attaching a class to an element just to give it position: relative; so that I can position it\'s children using position: absolute;

4条回答
  •  悲哀的现实
    2020-12-16 07:19

    The first thing that jumps to mind and one that we saw in one of our sites recently was that any absolutely positioned elements within those relatively positioned elements will have their position offset from that element.

    As an example that would be a problem if you were trying to position to the centre of the body.

提交回复
热议问题