我有一个列表,需要它上面的所有其他项目来更改颜色并删除它的边距。我使用了 nth-child,它在除 IE7-8 之外的所有设备上都能完美运行。我知道他们不支持nth-child,所以我使用了Jquery。
我发现这个::nth-child 不在 IE 中工作 ,这个:http: //verboselogging.com/2010/01/17/making-nth-child-work-everywhere
我试图实现它们,但它仍然无法正常工作。你可以在这里查看: http ://www.dffernandez.com/client_review_files/tests/nth-child.html
#prop-images-wrapper {
float: left;
margin-bottom: 0.6em;
background-color: #F00;
width: 340px;
margin-right: 5px;}
#prop-images-wrapper li:nth-child(2n+1), .difcolor {
margin-right: 0px;
background-color: #06F;}
--
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script>$(document).ready(function(){
$("#prop-images-wrapper li:nth-child(2n+1)").addClass("difcolor");
});</script>
先感谢您。