<!DOCTYPE html>
<html>
<head>
<title>Thuộc tính top khi dùng position fixed trong CSS</title>
<style>
div {width:100%; height:300px; float:left; background:red; margin-bottom:15px}
span{width:70px; height:30px; background:green; right: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 fixed trong CSS</h1>
<p>Thuộc tính top trong position fixed sẽ canh cạnh trên của phần tử HTML so với cạnh trên của trình duyệt:</p>
<div></div>
<div></div>
<div></div>
<span style="top:10px; position:fixed;">top:10px;</span>
<span style="top:50%; position:fixed;">top:50%;</span>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Thuộc tính top khi dùng position fixed trong CSS</title>
<style>
div {width:100%; height:300px; float:left; background:red; margin-bottom:15px}
span{width:70px; height:30px; background:green; right: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 fixed trong CSS</h1>
<p>Thuộc tính top trong position fixed sẽ canh cạnh trên của phần tử HTML so với cạnh trên của trình duyệt:</p>
<div></div>
<div></div>
<div></div>
<span style="top:10px; position:fixed;">top:10px;</span>
<span style="top:50%; position:fixed;">top:50%;</span>
</body>
</html>