css怎样让元素显示指定的宽高比

.father { width: 100% }
.child { width: 100%; height: 0; padding-bottom: 20%; background: green; overflow: hidden; }
<body>
     <div class="father">
        <div class="child"></div>
    </div>
</body>

 

posted @ 2020-02-03 14:11  ladybug7  阅读(212)  评论(0编辑  收藏  举报