码迷,mamicode.com
首页 > 编程语言 > 详细

1-选择器 计算法

时间:2017-06-26 12:39:59      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:eve   算法   color   简单   body   ast   选择器   n+1   last   

<!DOCTYPE html>
<html>
<head>
<style>
/*简单数字序号写法*/
li:nth-child(2){
   background-color:yellow;
}
/*倍数写法*/
li:nth-child(3n){
   background-color:green;
}
/*倍数分组匹配*/
li:nth-child(3n+1){
   background-color:red;
}
/*奇偶匹配*/
ol li:nth-child(odd){
   background-color:pink;
}

ol li:nth-child(even){
   background-color:blue;
}

/*only-child*/
#olid li:only-child{
   color:red;
}

#olid2 li:last-child{
   color:red;
}
</style>
</head>

<body>
<ul>
    <li>1</li>
    <li>2</li>
    <li>3</li>
</ul>

<ol>
    <li>1</li>
    <li>2</li>
    <li>3</li>
    <li>4</li>
</ol>

<ol id="olid">
    <li>1</li>
</ol>

<ol id="olid2">
    <li>1</li>
    <li>2</li>
    <li>3</li>
    <li>4</li>
</ol>
</body>
</html>

  

1-选择器 计算法

标签:eve   算法   color   简单   body   ast   选择器   n+1   last   

原文地址:http://www.cnblogs.com/1020182600HENG/p/7079675.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!