创作一个和宽度相等的正方形盒子
html代码:
<
div class=
"box-wrapper">
<
div class=
"box">
</
div>
</
div>
css代码:
.box-wrapper{
width: 200px;
background:yellow;
}
.box{
width: 100%;
height: 0;
padding-top: 100%;
background: rgba(0,0,0,.6);
position: relative;
}
最终效果:
转载请注明原文地址: https://www.6miu.com/read-41011.html