2011-09-04 60 views

回答

3

浮动元素不会影响其父项的大小。

可以解决这个问题通过应用overflowli元素:

ul#something li#someunit { 
    background: none repeat scroll 0 0 #F0F0F0; 
    border-radius: 10px 10px 10px 10px; 
    clear: both; 
    display: block; 
    position: relative; 
    overflow: hidden; 
} 

演示:http://jsbin.com/ubiquy/edit#preview

2

这是因为您正在浮动图像。尝试在关闭li之前添加一个div来标记具有明确属性的图像。

<div style="clear:both;"></div> 
</li> 
+0

是。在你的css中创建一个类,如下所示:'.clear {clear:both;}'然后将清除类添加到你的div中。 '

' – brenjt