|
|
|
|
|
|
| |
The top property (CSS Reference)
Introduction
The top property is used to determine the absolute position
from top for the content. This property is best used with the property
position. The following example demonstrates the usage and positions 3 strings
from top.
Example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>top Demonstration</title>
<style type="text/css">
p.top0
{
position:absolute;
top:50px;
}
p.top1
{
position:absolute;
top:75px;
}
p.top2
{
position:absolute;
top:100px;
}
</style>
</head>
<body>
<h1><p>The text should be somewhere at the
top.</p></h1>
<h1><p class="top0">Hello
World0</p></h1>
<h1><p class="top1">Hello World1</p></h1>
<h1><p class="top2">Hello
World2</p></h1>
</body>
</html>
Output

Values
|
Name:
|
Description:
|
|
auto
|
Defines the position automatically.
|
|
length
|
The following values can be also used to define the top
distance:
cm (centimeter)
em (ems)
inch (inches)
mm (millimeters)
pc (picas)
px (pixels)
pt (points)
|
|
percentage
|
Defines the distance of the content from top in
percentages. You have to use the percentage sign %.
|
|
|
|
|
|
|
|
|