定位叠放次序z-index(HTML、CSS)
原创
©著作权归作者所有:来自51CTO博客作者CMMKK的原创作品,请联系作者获取转载授权,否则将追究法律责任
定位叠放次序z-index(HTML、CSS)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>定位叠放次序z-index</title>
<style>
.box {
position: absolute;
top: 0;
left: 0;
width: 200px;
height: 200px;
}
.xiongda {
background-color: red;
z-index: 1;
}
.xionger {
background-color: green;
left: 50px;
top: 50px;
}
.qiangge {
background-color: skyblue;
left: 100px;
top: 100px;
}
</style>
</head>
<body>
<div class="box xiongda">熊大</div>
<div class="box xionger">熊二</div>
<div class="box qiangge">光头强</div>
</body>
</html>