Syntax | selector {top: value;}
|
---|---|
Usage | The top property is used to set the top position of an element's box. This property can be used for elements that have a position property value of relative, absolute, or fixed. The top property is used as follows:
This property is specified by using a length, percentage, or keyword, according to the syntax shown above. If a percentage value is used, the value will be a percentage of the containing block's height. CSS Example: The top properties are set for 2 different elements which are using the relative and absolute position properties. #tst1 {position: relative; top: 40px;} #tst2 {position: absolute; top: 40px;} |
Keywords |
|
Applies To | Elements that have a position property value of relative, absolute, or fixed. |
Inherited | No |
Initial Value | auto |
The top properties are set for 2 different elements which are using the relative and absolute position properties. |