<!DOCTYPE html>
<html>
<head>
<title>Thuộc tính top khi dùng position relative trong CSS</title>
<style>
#divtong{width:100%; height:300px; background:red;}
#divtong p{width:100px; height:30px; background:green; left:10px; z-index:1; line-height:30px; text-align:center; color:#fff}
</style>
</head>
<body>
<h1>Thuộc tính top khi dùng position relative trong CSS</h1>
<p>Thuộc tính top trong position relative sẽ canh cạnh trên của phần tử HTML so với cạnh trên của phần tử cha:</p>
<div id="divtong">
<p style="top: 0px; position:relative;">top: 0px;</p>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Thuộc tính top khi dùng position relative trong CSS</title>
<style>
#divtong{width:100%; height:300px; background:red;}
#divtong p{width:100px; height:30px; background:green; left:10px; z-index:1; line-height:30px; text-align:center; color:#fff}
</style>
</head>
<body>
<h1>Thuộc tính top khi dùng position relative trong CSS</h1>
<p>Thuộc tính top trong position relative sẽ canh cạnh trên của phần tử HTML so với cạnh trên của phần tử cha:</p>
<div id="divtong">
<p style="top: 0px; position:relative;">top: 0px;</p>
</div>
</body>
</html>