美文网首页
定位 position

定位 position

作者: 楼水流云 | 来源:发表于2019-10-09 16:58 被阅读0次

1、relative --相对定位元素 相对自己的位置做定位 left-right-top-bottom
2、absolute --绝对定位的元素 相对父容器内边框做定位
父元素要设置定位 left-right-top-bottom
不设置宽度是由内容决定大小

3、z-index --设置绝对定位的叠放顺序,z-index越高,元素位置越靠上
3、fixed --固定定位的元素 相对于窗口 left-right-top-bottom

5、inherit --规定应该从父元素继承position属性的值
6、static --默认值,没有定位,元素出现在正常的流中(忽略top\bottom\left\right\或者z-index声明)
7、sticky --css3新属性,表现类似position:relative和position:fixed的合体,在目标区域在屏幕中可见

相关文章

网友评论

      本文标题:定位 position

      本文链接:https://www.haomeiwen.com/subject/eeqcpctx.html