在下面的demo中,写有缩放属性的标签,会呈现出脱标的效果(本人未查到资料有写,望大佬改正)
看代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
.bigbox {
position: relative;
margin: 100px auto;
height: 600px;
width: 600px;
border: 1px solid #000;
}
.bigbox div {
width: 200px;
height: 200px;
}
.box1 {
position: absolute;
/* 设置层级高于定位的级别 */
/* z-index: 1; */
background-color: pink;
}
.box2 {
/* 带有缩放属性的盒子,呈现脱标,且级别为0 */
transform: scale(1);
background-color: skyblue;
}
.box3 {
position: absolute;
background-color: green;
}
</style>
</head>
<body>
<div class="bigbox">
<div class="box1">11111</div>
<div class="box2">22222</div>
<div class="box3">33333</div>
</div>
</body>
</html>
效果图:
![](https://img-blog.csdnimg.cn/img_convert/bb04e71abc0e078c3fc3f0dd92c0322f.png)
可以看到,带有缩放的盒子层叠在了前面带有定位的盒子上方,表现出脱标的效果。