在div上的相对设置是否使它脱离文档流? [英] Does setting position to relative on a div takes it out of document flow?

查看:149
本文介绍了在div上的相对设置是否使它脱离文档流?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是在div上声明 position:relative ,而不指定位置坐标(如top,left等)会使它脱离正常文档吗? Plz提供推理。

Does just declaring position:relative on a div without specify position coordinates such as top,left etc takes it out of normal document ? Plz provide reasoning.

感谢
dkj。

thanks dkj.

推荐答案

不,它不。 相对定位不影响布局,定位元素仍然在其起始位置 ,因此 / strong>。

No it doesn't. relative positioning doesn't affect the layout, the positioned element is still in its initial place logically, hence the occupied space is reserved.

但它可以通过顶部,<$> c $ c> right , bottom left offsets / properties。

But it could be displaced visually by top, right, bottom, left offsets/properties.


9.3.1选择定位方案:position属性

9.3.1 Choosing a positioning scheme: 'position' property

/ code> 框的位置是根据正常流量(这称为正常流量中的位置)。然后
该框相对于其正常位置偏移。当盒子B是
相对定位时,下一盒子的位置被计算为
,就像B没有偏移一样。 [...]

relative The box's position is calculated according to the normal flow (this is called the position in normal flow). Then the box is offset relative to its normal position. When a box B is relatively positioned, the position of the following box is calculated as though B were not offset. [...]

这篇关于在div上的相对设置是否使它脱离文档流?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆