:nth-child(2)选取第几个标签,“2可以是你想要的数字”

.demo01 li:nth-child(2){background:#090}

:nth-child(n+4)选取大于等于4标签,“n”表示从整数,下同

.demo01 li:nth-child(n+4){background:#090}

:nth-child(-n+4)选取小于等于4标签

.demo01 li:nth-child(-n+4){background:#090}

:nth-child(2n)选取偶数标签,2n也可以是even

.demo01 li:nth-child(2n){background:#090}

:nth-child(2n-1)选取奇数标签,2n-1可以是odd

.demo01 li:nth-child(2n-1){background:#090}

:nth-child(3n+1)自定义选取标签,3n+1表示“隔二取一”

.demo01 li:nth-child(3n+1){background:#090}

:last-child选取最后一个标签

.demo01 li:last-child{background:#090}

:nth-last-child(3)选取倒数第几个标签,3表示选取第3个

.demo01 li:nth-last-child(3){background:#090}

:nth-child的这些用法在实际中很用得着,不用单独给需要选取的标签加上ID或Class
 
 
 

最新文章

  1. mui 手势事件配置
  2. mybatis mysql 调用视图
  3. 五、HTML判断输入长度,体会字体颜色变化
  4. Fluent NHibernate and Mysql,SQLite,PostgreSQL
  5. 为什么要用VisualSVN Server,而不用Subversion?
  6. <转载>gcc/g++编译
  7. javascript中的原型和闭包
  8. HTML基础和表格
  9. bzoj 1095 [ZJOI2007]Hide 捉迷藏(括号序列+线段树)
  10. Invitation Cards(邻接表+逆向建图+SPFA)
  11. COJN 0484 800502电池的寿命
  12. Backbone的RESTFUL API 解释
  13. Python新手学习基础之循环结构练习
  14. php修改配置文件php.ini设置文件上传大小讲解
  15. java_监控工具jvisualvm
  16. 【20170521校内模拟赛】热爱生活的小Z
  17. SpringBoot从零单排 ------初级入门篇
  18. 仅仅有五行的Floyd最短路算法
  19. 站在DevOps肩膀上的TestOps(二)
  20. ngui 适配iphone x

热门文章

  1. Linux 入侵检测
  2. 文件上传:input file FileReader
  3. 59. Spiral Matrix II (Array)
  4. 30. Substring with Concatenation of All Words (String; HashTable)
  5. mac下yii安装
  6. c语言字符串指针
  7. rabbitmq的延迟消息队列实现
  8. AI ML DL
  9. 常见的C语言内存错误及对策(转)
  10. Caffe 议事(二):从零开始搭建 ResNet 之 网络的搭建(上)