代码拉取完成,页面将自动刷新
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>10 CSS 定位</title>
<style>
.box1{
height: 350px;
background-color: aqua;
}
.box-normal{
width: 100px;
height: 100px;
background-color: purple;
}
.box-relative{
width: 100px;
height: 100px;
background-color: pink;
position: relative; /* 相对定位 */
left: 120px;
top:40px;
}
.box2{
height: 350px;
background-color: yellowgreen;
margin-bottom: 200px;
}
.box-absolute{
width: 100px;
height: 100px;
background-color: darkorange;
position: absolute; /* 相对定位 */
left: 120px;
}
.box-fixed{
width: 100px;
height: 100px;
background-color: brown;
position: fixed; /* 固定定位 */
right: 0;
top: 300px;
}
</style>
</head>
<body>
<h1>10 CSS 定位</h1>
<h2>1.相对定位</h2>
<div class="box1">
<div class="box-normal">正常1</div>
<div class="box-relative">1相对</div>
<div class="box-normal">正常2</div>
</div>
<h2>2.绝对定位</h2>
<div class="box2">
<div class="box-normal">正常3</div>
<div class="box-absolute">2绝对</div>
<div class="box-normal">正常4</div>
</div>
<h2>3.固定定位</h2>
<div class="box-fixed">3固定
</div>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。