css3列表属性

</head>
<!--first-child--给元素中的第一个子表签改变效果-->
<style>
li:first-child{
background-color:#00F;
}
/*last-child--给元素中最后一个标签改变效果*/
li:last-child{
background-color:#0F9;
}
/*li:nth-child()--给指定的位置添加属性,从上往下数*/
li:nth-child(3){
background-color:#0F6;

}
/*li:nth-last-child()--给制定位置添加属性,从下往上数*/
li:net-last-child(2){
background-color:#3CF;
}
/*li:nth-last-child(add)--给基数添加属性*/
/*li:nth-last-child(even)--给偶数添加属性*/
</style>

<body>
<h2>列表</h2>
<ul>
<li>列表1</li>
<li>列表2</li>
<li>列表3</li>
<li>列表4</li>
<li>列表5</li>
<li>列表6</li>
</ul>
</body>
</html>

posted @ 2015-07-29 14:34  大发明家  阅读(297)  评论(0编辑  收藏  举报