position

作者: bestCindy | 来源:发表于2020-10-02 21:29 被阅读0次

position 属性可能的值有四种:static, relative, absolute, fixed。

- static: 默认值,没有定位,元素在正常的流中进行显示,left, right, top,  bottom 属性或者 z-index 声明不可用

- relative:生成相对定位的元素,相对于元素在标准流中的位置进行定位,可以使用 left, right, top, bottom 属性;

- absolute: 生成绝对定位的元素,可以使用 left, right, top, bottom 属性; 相对于离它最近的 position 不为 static 的元素定位,如果没有的话相对于 body ,脱离文档流

- fixed: 生成固定定位的元素,可以使用 left, right, top, bottom 属性,相对于浏览器窗口是固定的,不随着文档进行移动。

相关文章

网友评论

      本文标题:position

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