css實現高度自適應正方形
阿新 • • 發佈:2018-10-12
spl splay code gin tle margin content div hidden
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<style type="text/css">
.div{
background: red;
width: 20%;
overflow: hidden;
}
.div:after{
content: ‘‘;
display: block;
margin-top: 100%;
}
</style>
<body>
<div class="div"></div>
</body>
</html>
css實現高度自適應正方形