<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.container {
position: relative;
width: 200px;
height: 200px;
}
.layer {
position: absolute;
color: white;
display: flex;
justify-content: flex-end;
align-items: flex-end;
padding: 8px;
}
.layer-1 {
background: #e94560;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
}
.layer-2 {
background: #0f3460;
width: 150px;
height: 150px;
top: 0;
left: 0;
z-index: 2;
}
.layer-3 {
background: #10b981;
width: 100px;
height: 100px;
top: 0;
left: 0;
z-index: 3;
}
</style>
</head>
<body>
<div class="container">
<div class="layer layer-1">底层</div>
<div class="layer layer-2">中间层</div>
<div class="layer layer-3">顶层</div>
</div>
</body>
</html>
Read-only