The position property, together with the float property, controls the way in which the position of the element’s generated box is computed. See Positioning for details about element positioning.
position属性与float属性一起控制计算元素生成框的位置的方式。 有关元素定位的详细信息,请参见定位 。
Boxes with a position value other than static are said to be positioned. Their vertical placement in the stacking context is determined by the z-index property.
具有非静态位置值的盒子被放置。 它们在堆叠上下文中的垂直放置由z-index属性确定。
absolute The value absolute generates an absolutely positioned box that’s positioned relative to its containing block. The position can be specified using one or more of the properties top, right, bottom, and left. Absolutely positioned boxes are removed from the flow and have no effect on later siblings. Margins on absolutely positioned boxes never collapse with margins on other boxes.
absolute值absolute生成一个绝对定位的框,该框相对于其包含的块定位。 可以使用top , right , bottom和left属性中的一个或多个来指定位置。 绝对定位的盒子将从流程中删除,并且对以后的同级兄弟没有任何影响。 绝对定位的框上的边距永远不会与其他框上的边距一起崩溃。
fixed The value fixed generates an absolutely positioned box that’s positioned relative to the initial containing block (normally the viewport). The position can be specified using one or more of the properties top, right, bottom, and left. In the print media type, the element is rendered on every page.
fixed值fixed生成一个绝对定位的框,该框相对于初始包含块(通常是视口)定位。 可以使用top , right , bottom和left属性中的一个或多个来指定位置。 在打印介质类型中,元素在每个页面上呈现。
relative The value relative generates a positioned box whose position is first computed as for the normal flow. The generated box is then offset from this position according to the properties top or bottom and/or left or right. The position of the following box is computed as if the relatively positioned box occupied the position that was computed before the box was offset. This value cannot be used for table cells, columns, column groups, rows, row groups, or captions.
relative值relative生成一个定位框,该框的位置首先按照法线流计算。 然后根据属性top或bottom和/或left或right从此位置偏移生成的框。 计算下一个框的位置,就好像相对定位的框占据了在框偏移之前计算出的位置一样。 此值不能用于表格单元格,列,列组,行,行组或标题。
static The value static generates a box that isn’t positioned, but occurs in the normal flow. The properties top, right, bottom, left, and z-index are ignored for static boxes.
static值static生成一个未定位的框,但会在常规流中出现。 静态框将忽略属性top , right , bottom , left和z-index 。
inherit The value inherit causes the element to take the same computed value as its parent (see The CSS Property Value inherit) for more information.
inherit值inherit使元素采用与其父代相同的计算值(请参阅CSS属性值继承 )以获取更多信息。
翻译自: https://www.sitepoint.com/position-css-property/
相关资源:jdk-8u281-windows-x64.exe