div 宽高相等2种实现方式

时间:2024-01-13 22:35:14
div.wh{
background:#ff0;width:50%;position:relative;display:inline-block;
}
div.wh:before{
content: "";
display: inline-block;
padding-bottom: 100%;
width: .1px;
vertical-align: middle;
}
div.wh{
background:#ff0;
display:inline-block;
width:50%;
padding-bottom: 50%;
}