top

UK[tɒp] US[tɑ:p]

n. Top, top; (box) cover, (book pages, etc.) upper column ; chief; top

vi.Summary; transcend; tower; end

css top attribute syntax

Function:The top attribute specifies the top edge of the element. This property defines the offset between the top margin boundary of a positioned element and the top boundary of its containing block.

Description: For static elements, it is auto; for length values, it is the corresponding absolute length; for percentage values, it is the specified value; otherwise, it is auto. For relative definition elements, if top and bottom are both auto, their calculated values ​​are both 0; if one of them is auto, the opposite of the other value is taken; if neither is auto, bottom will be the opposite of the top value. Opposite number.

Note: All major browsers support the top attribute. The attribute value "inherit" is not supported in any version of Internet Explorer (including IE8).

css top attribute example

<html>
<head>
<style type="text/css">
img
{
position:absolute;
top:5px;
}
</style>
</head>
<body>
<img src="http://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg" />
<h1>This is a heading</h1>
</body>
</html>
Run instance »

Click the "Run instance" button to view the online instance