日期:2014-05-17  浏览次数:20710 次

<li><ul>背景颜色的范围
<li> <ul> 不是块状元素那他们的背景颜色的宽度根据什么而定

------解决方案--------------------
UL不是块级元素?
------解决方案--------------------
1、块不块是可以根据 display 属性来指定的。
2、ul li同样可以设置width height background等属性。

http://bolm.cn
------解决方案--------------------
<ul style= "width:200px;height:300px ">
<li style= "width:100px;background-color:#0000FF "> item1 <br/>
</li>
<li style= "width:100px;background-color:#008080 "> item2 <br/>
</li>
</ul>
------解决方案--------------------
当指定了width和height后,它就是块级元素了
再设置个背景就能看出差异