原创声明:本文为作者原创,未经允许不得转载,经授权转载需注明作者和出处
<style type="text/css">
    .hot-imgs{
        width: 100%;
        overflow: hidden;
    }
    .hot-imgs li{
        float: left;
        width: 100%;
        height: 0;
        padding-bottom: 100%;        //关键所在
        overflow: hidden;
        background:url(../res/images/haha.png) center/100% 100% no-repeat;
    }
    .hot-imgs li img{
        width: 100%;
    }
</style>
<ul class="hot-imgs">
    <li></li>
</ul>

padding的百分比数值是根据当前元素的宽度来计算的padding只能取top或者bottom,其值要和宽一致<style type="text/css">
    .web_width{
        width: 100%;
        overflow: hidden;            //关键所在
    }
    .left{
        float: left;
        width: 20%;
        min-height: 10em;
        background: #66afe9;
        padding-bottom: 2000px;        //关键所在
        margin-bottom: -2000px;        //关键所在
    }
    .right{
        float: right;
        width: 80%;
        height: 20em;
        background: #f00;
    }
</style>

在高度小的元素上加一个数值为正padding-bottom和一个数值为负margin-bottom,再在父级加上overflow: hidden隐藏子元素超出的padding-bottom
padding-bottom、margin-bottom之和要等于0em是为了做gif效果更明显(在我的笔记里面翻出来了,用这个解决了很多布局问题)