语法 | 说明 | 文档流 | 偏移位置 (top left right bottom)时候的参照物 | 层叠顺序 (Z-index) |
position: static | 默认值 | 默认 | 默认 | z-index厲性是不带 单位的,并且可以给 负值,没有设置z- index时,最后写的 对象优先显示在上层, 设置后,数值越大, 层越靠上; |
position: absolute | 绝对定位 | 脱离 |
|
|
position: relative | 相对定位 | 不脱离 | 自己的初始位置 | |
position: fixed | 固定定位 | 脱离 | 浏览器的当前窗口 | |
position: sticky | 粘性定位 | 可以做吸顶效果,粘性定位是css3.0新增加的,兼容不好 |
Html-定位(Position)
猜你喜欢
转载自blog.csdn.net/a451319296/article/details/128105504
今日推荐
周排行