nth-child 的一些小尝试
来源:互联网 发布:i排版软件 编辑:程序博客网 时间:2024/06/03 12:41
nth-child 的一些小尝试
前言
对于 first-child 或者 last-child 等,还算比较常用.但是 nth-child 一般也就用隔行变色.一直不认为其有多强大的功能,甚至认为其比较鸡肋.
但是今天深入研究了一下,发现这货不是一点半星的强大啊!!!!不废话,直接上代码
code
<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>nth-child test</title></head><body> <ul> <li>this is title 1</li> <li>this is title 2</li> <li>this is title 3</li> <li>this is title 4</li> <li>this is title 5</li> <li>this is title 6</li> <li>this is title 7</li> <li>this is title 8</li> <li>this is title 9</li> <li>this is title 10</li> <li>this is title 11</li> <li>this is title 12</li> <li>this is title 13</li> <li>this is title 14</li> <li>this is title 15</li> <li>this is title 16</li> <li>this is title 17</li> <li>this is title 18</li> <li>this is title 19</li> <li>this is title 20</li> </ul></body></html><style> li:nth-child(1){background: #fda;} li:nth-child(3n){background: #daf;} li:nth-child(-n+4) {font-weight: bold;} li:nth-child(5n){border-bottom: 1px solid #ddd;padding-bottom: 20px;margin-bottom: 20px;} li:nth-child(n+5) {text-indent: 10px;} li:nth-child(3n+1) {color: #f00;} li:nth-child(3n-1) {color: #00f;}</style>
太TM灵活了,以后这种地方,根本就不需要加上 class啦!!!!
更多内容阅读
精通:nth-child
关于nth-child的疑惑
w3school:CSS3 :nth-child() 选择器我就是看了这个才认为这玩意儿鸡肋的,W3S害死人啊!!!
0 0
- nth-child 的一些小尝试
- :nth-child的用法
- nth-child的用法
- nth-child的正确理解
- nth-child的使用
- :nth-child(index)和nth-child(index)选择器的区别
- 有用的:nth-child秘方
- JQuery nth-child的使用
- 关于nth-child的疑惑
- CSS3的nth-child选择器
- CSS3:nth-child的用法
- nth-child选择(小研究)
- :nth-child()
- nodejs+socketio+redis的一些小尝试
- 对Promise的一些小尝试
- CSS中first-child和nth-child的讲解
- CSS中first-child和nth-child的讲解
- [翻译]nth-child的工作机制
- iOS~block的使用
- liunx 批量删除进程 利用xargs
- 39. Combination Sum && 40. Combination Sum II
- 数据库设计三大范式
- Ubuntu 14.04下NFS安装配置
- nth-child 的一些小尝试
- python解析xml文件注意
- redis入门
- 从头认识java-17.4 详解同步(2)-详解竞争条件
- 如何使用EndNote进行文献管理
- 2015年总结与2016年期望
- 65条最常用正则表达式,你要的都在这里了
- ios-基础用法之【1】-NSLog用法
- Fuel安装方法