<!DOCTYPE html>
<html>
<head>
<style>
div.a {
position: relative;
width: 400px;
height: 200px;
border: 3px solid red;
}
div.b {
position: absolute;
top: -20px;
border: 3px solid blue;
}
div.c {
position: absolute;
top: 150px;
border: 3px solid green;
}
</style>
</head>
<body>
<h1>The top Property</h1>
<div class="a">This div element has position: relative;
<div class="b">This div element has position: absolute and top: -20px.</div>
</div>
<div class="c">This div element has no parent element, has position: absolute and is placed 150 pixels down from the top of the document body.</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
div.a {
position: relative;
width: 400px;
height: 200px;
border: 3px solid red;
}
div.b {
position: absolute;
top: -20px;
border: 3px solid blue;
}
div.c {
position: absolute;
top: 150px;
border: 3px solid green;
}
</style>
</head>
<body>
<h1>The top Property</h1>
<div class="a">This div element has position: relative;
<div class="b">This div element has position: absolute and top: -20px.</div>
</div>
<div class="c">This div element has no parent element, has position: absolute and is placed 150 pixels down from the top of the document body.</div>
</body>
</html>
发布评论
评论(1)
让我尝试回答你的问题,我的朋友。
也许我有两种方法来回答你的问题。
或者你可以喜欢这个
抱歉我的虚假 如果我虚假的话
Let me to try answer your quetion my friend.
Maybe i have two way to answer your question.
or you can like this
sorry for my false if i false