我想要一个 div 内的备用背景颜色。我通过下面的代码完成了:
我希望我的第一行以 bgcolor 呈现,而下一行以另一种颜色呈现。
我试过了,但没有用。这是代码:
<script type="text/javascript">
$(document).ready(function() {
$(".rowBg div:odd").addClass("altBg");
});
</script>
/*CSS*/
div.rowBg div { clear:both; padding:0; overflow:hidden }
div.altBg { background-color:#eee !important; overflow:hidden; padding:5px 0 }
<!--HTML-->
<div class="rowBg">
<div>
<!--Row1-->
<span class="alphabets">A</span>
<span class="itemNames">
<ul>
<li><a href="../locate/refine.html?N=4294963558">Acer America</a></li>
<li><a href="../promotions/index.html?page_id=3703">Acronis</a></li>
<li><a href="../locate/refine.html?N=4294966145">Adaptec</a></li>
<li><a href="../promotions/index.html?page_id=3163">Adobe</a></li>
<li><a href="../promotions/index.html?page_id=4402">AirWatch</a></li>
</ul>
</span>
</div>
<!--Row 2-->
<div>
<!--Row1-->
<span class="alphabets">A</span>
<span class="itemNames">
<ul>
<li><a href="../locate/refine.html?N=4294963558">Acer America</a></li>
<li><a href="../promotions/index.html?page_id=3703">Acronis</a></li>
<li><a href="../locate/refine.html?N=4294966145">Adaptec</a></li>
<li><a href="../promotions/index.html?page_id=3163">Adobe</a></li>
<li><a href="../promotions/index.html?page_id=4402">AirWatch</a></li>
</ul>
</span>
</div>
</div>
谢谢,