Home  >  Q&A  >  body text

谁能够系统地总结一下三种定位模式的区别呢?万分感谢

谁能够系统地总结一下三种定位模式的区别呢?万分感谢

phpcn_u251phpcn_u2512830 days ago1216

reply all(2)I'll reply

  • 数据分析师

    数据分析师2017-09-30 23:21:12

    Who can systematically summarize the differences between the three positioning modes? Thank you very much - PHP Chinese website Q&A - Who can systematically summarize the differences between the three positioning modes? Thank you very much - PHP Chinese website Q&A

    Please watch and learn.

    reply
    0
  • 阿神

    阿神2016-12-21 11:07:15

    position定位值共有五种:

    1.static,默认值。没有定位,元素出现在正常的流中(忽略 top, bottom, left, right 或者 z-index 声明)。

    2.inherit,规定应该从父元素继承 position 属性的值。

    3.absolute,生成绝对定位的元素,相对于 static 定位以外的第一个父元素进行定位。元素的位置通过 "left", "top", "right" 以及 "bottom" 属性进行规定。

    4.fixed,生成绝对定位的元素,相对于浏览器窗口进行定位。元素的位置通过 "left", "top", "right" 以及 "bottom" 属性进行规定。

    5.relative,生成相对定位的元素,相对于其正常位置进行定位。因此,"left:20" 会向元素的 LEFT 位置添加 20 像素。

    reply
    0
  • Cancelreply