Property Description
The position property is used to position an element.
This property has the following syntax:
position: absolute|fixed|relative|static|initial|inherit;
Property Values
| Value | Description |
|---|---|
| absolute | Generates an absolutely positioned element, positioned relative to the first parent element that has a position other than static. The element's position is specified with the "left", "top", "right", and "bottom" properties |
| fixed | Generates an absolutely positioned element, positioned relative to the browser window. The element's position is specified with the "left", "top", "right", and "bottom" properties |
| relative | Generates a relatively positioned element, positioned relative to its normal position |
| static | (default) No position, the element occurs in the normal flow (ignores any top, bottom, left, right, or z-index declarations) |
| initial | Specifies that the value of the property should be set to the default value |
| inherit | Specifies that the value of the property should be inherited from the parent element |
Examples
This example specifies the position an h1 element.
h1 {
position:absolute;
left:50px;
top:100px;
}
Browser Support
| Chrome | Firefox | IE | Safari | Opera |
|---|---|---|---|---|
| 1.0 | 1.0 | 7.0 | 1.0 | 4.0 |
Miscellaneous Information
| Inherited: | No |
|---|---|
| Defined In: | CSS2 |
| Default Value: | static |
