DOM结构如下
<style type="text/css"> .overflow{ overflow: hidden; height: 5px; } ul{ height: 300px; z-index: 2px; } </style> <div class="overflow"> <ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> </ul> </div>
这里,我给父容器使用overflow的目的,是为了清理浮动。我的本质还是希望ul可以完全展示出来
为了避免overflow:hidden清理浮动的方式,产生的如上文的效果,刚才搜索了一下,找到了这种方案来清理
/* For modern browsers */ .cf:before, .cf:after { content:""; display:block; } .cf:after { clear:both; } /* For IE 6/7 (trigger hasLayout) */ .cf { zoom:1; }