The best CSS position property Tutorial In 2024, In this tutorial you can learn Examples,Attribute definitions and instructions,Browser Support,Property Value,More examples,related articles,
Location <h2> element:
Position attribute specifies the type of an element (static, relative, absolute or fixed) positioning method.
Defaults: | static |
---|---|
inherit: | no |
version: | CSS2 |
JavaScript syntax: | object .style.position = "absolute" |
Figures in the table represent the first browser to support the version number of the property.
属性 | |||||
---|---|---|---|---|---|
position | 1.0 | 7.0 | 1.0 | 1.0 | 4.0 |
value | description |
---|---|
absolute | Generate absolute positioned elements, relative to the first parent element positioned outside the static positioning. Position of the element by the "left", "top", "right" and "bottom" attribute specified. |
fixed | Generate absolute positioning of elements relative to the browser window positioning. Position of the element by the "left", "top", "right" and "bottom" attribute specified. |
relative | Generating element relative positioning, positioning relative to its normal position. Thus, "left: 20" adds 20 pixels to the element's LEFT position. |
static | Defaults. No positioning element occurs in normal flow (ignoring the top, bottom, left, right or z-index statement). |
inherit | Provisions should inherit the property value position from the parent element. |
Position: relative
This example demonstrates an element relative to its normal position, how to locate.
CSS tutorial: CSS Positioning