<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>z-index叠放顺序</title>
<style>
.one{
width: 200px;
height: 200px;
background-color: red;
position: absolute;
z-index: 2;
}
.two{
width: 200px;
height: 200px;
margin: 10px;
background-color: green;
position: absolute;
z-index: 3;
}
.three{
width: 200px;
height: 200px;
margin: 20px;
background-color: blue;
position: absolute;
z-index: 1;
}
</style>
</head>
<body>
<div class="one"></div>
<div class="two"></div>
<div class="three"></div>
</body>
</html>
z-index叠放顺序
最新推荐文章于 2022-08-31 17:27:54 发布
本文通过实例详细解析了CSS中z-index属性的作用,展示了如何通过设置不同的z-index值来控制网页元素的堆叠顺序,使页面布局更加灵活且符合设计需求。
476

被折叠的 条评论
为什么被折叠?



