Name

top

Synopsis

This property defines the offset between the top outer margin edge of a positioned element and the top edge of its containing block.

Values:

<length> | <percentage> | auto | inherit

Initial value:

auto

Applies to:

positioned elements (that is, elements for which the value of position is something other than static)

Inherited:

no

Percentages:

refer to the height of the containing block

Computed value:

for relatively positioned elements, see note; for static elements, auto; for length values, the corresponding absolute length; for percentage values, the specified value; otherwise, auto

Note:

for relatively positioned elements, if both top and bottom are auto, their computed values are both 0; if one of them is auto, it becomes the negative of the other; if neither is auto, bottom will become the negative of the value of top

Get Cascading Style Sheets: The Definitive Guide, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.