Glubase - share your knowledge


All / Computers / Programming / CSS





  • View Command

CSS Reference

CSS top definition

Browser support
IEFFOpSaf

Type:

Syntax

top: auto | <percentage> | <length>

Description

For absolutely positioned elements this property defines how far the top edge of an element is below the top edge of the containing block (beginning at the padding's edge). The containing block of an absolutely positioned element is the first ancestor whose position property is set to absolute, fixed or relative.

For relatively positioned elements this property defines how far the top edge of the element is below the position that the element would be at normally. 

Values

Values Description
auto Default. The browser calculates the top position.
percentage Defines a top position percentage value from the edge of an element.
length Defines a top position length from the edge of an element.

Version Information

Available since CSS 2.0

See Also

direction

Example

[Try this example yourself]
<style type="text/css">
.absoluteposition
{
position:absolute;
top:25px;
right:15px;
}
</style>
<div style="position:absolute;width:100%">
<p class="absoluteposition">Some absolutely positioned text.</p>
<p>Some ordinary text</p>
<p>Some ordinary text</p>
<p>Some ordinary text</p>
<p>Some ordinary text</p>
<p>Some ordinary text</p>
</div>

Output

Some absolutely positioned text.

Some ordinary text

Some ordinary text

Some ordinary text

Some ordinary text

Some ordinary text

  • Comments

No comments added.