css3之nth-child和nth-of-type
来源:互联网 发布:mac的终端文件路径 编辑:程序博客网 时间:2024/05/17 17:58
nth-child
p:nth-child(n){//表示p的父元素下的第n个子元素}
nth-of-type
p:nth-of-type(n){//表示p的父元素下的第n个子元素且这个子元素是p}
举例:nth-of-type
<p>1</p><p>2</p><span>3</span><p>4</p><p>5</p>p:nth-of-type(odd){ background:red;//表示第奇数个p元素,即内容为1,4}p:nth-of-type(even){ background:green;//表示第偶数个p元素,即内容为2,5}
显示结果如下:
举例:nth-child
<p>1</p><p>2</p><span>3</span><p>4</p><p>5</p>p:nth-child(odd){ background:red;//表示第奇数个子元素,且子元素为p,即内容为1,5}p:nth-child(even){ background:green;//表示第偶数个子元素,且子元素为p,即内容为2,4}
显示结果如下:
阅读全文
0 0
- css3之nth-child和nth-of-type
- CSS3之nth-child与nth-of-type
- CSS3 :nth-child() 与:nth-of-type()
- CSS3中:nth-child和:nth-of-type的区别
- CSS3中:nth-child和:nth-of-type的区别
- CSS3—nth-child()和nth-of-type()
- css3 :nth-child和:nth-of-type的区别
- CSS3 :nth-child() ,nth-of-type(),nth-last-child() ,nth-last-of-type()
- nth-child和nth-of-type区别
- 浅谈:nth-child和:nth-of-type
- :nth-child和:nth-of-type
- CSS3::nth-child与:nth-of-type区别
- CSS3子元素选择方法nth-child和nth-of-type
- CSS3伪类选择器nth-child和nth-of-type浅析
- CSS3的nth-child() 和nth-of-type()选择器,表格奇偶行变色
- CSS3中:nth-child()和nth-of-type()的却别
- css3中nth-child选择器和nth-of-type选择器的区别
- CSS3选择器:nth-child和:nth-of-type之间的差异
- 菜鸟的java多数据库切换手动实现,欢迎指点
- git revert和git reset
- 第一个只出现一次的字符
- Van Emde Boas Trees
- 对象属性复制工具类
- css3之nth-child和nth-of-type
- Kaggle泰坦尼克预测(完整分析)
- 获取包信息
- greendao3 使用和源码分析
- 寻找三角形
- SimpleSniffer
- 面试题20:顺时针打印矩阵
- Android广播BroadcastReceiver
- C#学习笔记(9)—–多线程基础(上)