One: css1.1:position definition and usage
The Position property specifies the positioning type of the element.
Possible values
| value |
Description |
| Absolute |
Creates an absolutely positioned element that is positioned relative to the first parent element other than the static anchor.
The position of the element is defined by the "left", "Top", "right" and "bottom" attributes. |
| Fixed |
Generates an absolutely positioned element that is positioned relative to the browser window.
The position of the element is defined by the "left", "Top", "right" and "bottom" attributes. |
| Relative |
Creates a relative positioned element, positioned relative to its normal position.
Therefore, "left:20" adds 20 pixels to the left position of the element. |
| Static |
The default value. No positioning, elements appear in the normal stream (ignoring top, bottom, left, right, or z-index declarations). |
| Inherit |
Specifies that the value of the position property should be inherited from the parent element. |
View full Code
<!DOCTYPE HTML><HTMLLang= "en"><Head> <MetaCharSet= "UTF-8"> <title>Title</title> <styletype= "Text/css">. Box{Border:1px solid #f60;width:100px;Height:100px;margin:0 Auto;-webkit-border-radius:50px;-moz-border-radius:50px;-o-border-radius:50px;Border-radius:50px; } </style></Head><Body> <Divstyle= "position:relative;width:500px;height:300px;border:2px solid red;margin:0 Auto"> <Divstyle= "position:absolute;width:50px;height:50px;background-color:black;left:0;bottom:0"></Div> <Divstyle= "position:absolute;width:50px;height:50px;background-color:blue;right:0;bottom:0"></Div> <Divstyle= "position:absolute;width:50px;height:50px;background-color:red;right:0;top:0"></Div> <Divstyle= "position:absolute;width:50px;height:50px;background-color:darkgoldenrod;top:0;bottom:0"></Div> <Divclass= "box"style= "Position:absolute; Top:50%;left:50%;margin-top: -50px;margin-left: -50px; "></Div> </Div></Body></HTML>position
CSS, JavaScript, Dom