CSS property: top

Description

Absolute position from the top edge of the containing block.

Syntax

top: <length> | <percentage> | auto;

Values

auto (by default)

For non-replaced elements, the effect of this value depends on which of related properties have the value auto as well.

<length>

The offset is a fixed distance from the reference edge. Negative values are allowed.

<percentage>

The offset is a percentage of the containing block's height. Negative values are allowed.

Versions

Examples

p {
    position: absolute;
    top: 0;
}