back

Top

Top is used to help to specify the position for positioned elements.
The other positioning properties are bottom, left, and right.

For elements that are absolutely positioned, top specifies the distance between the top margin edge of the element and the top of its containing block.

For elements that are relatively positioned, it specifies how far the element is moved below its normal position.

Negative values mean that the element is moved up rather than down.

The options are:
(1) Auto, the default value, it means the browser will calculate the position.
(2) Length, allows you to set the value as a fixed length, for example in px or cm.
(3) Percentage, allows you to set the value as a percentage of the containing elements height.
(4) Inherit, the value is inherited from its parent element.

Example