CSS3 :nth-child() 与:nth-of-type()
来源:互联网 发布:c专家编程 在线阅读 编辑:程序博客网 时间:2024/04/29 10:44
:nth-child()选择器,该选择器选取父元素的第 N 个子元素,与类型无关
:nth-of-type() 选择器匹配属于父元素的特定类型的第 N 个子元素的每个元素
以下代码可以看出区别。
代码:
<div>
<p class="item">123</p>
<p class="item">123<p>
<h2 class="item">123</h2>
<p class="item">123</p>
<p class="item">123</p>
<p class="item">123</p>
<p>123</p>
</div>
.item:nth-child(3n){background-color:red;}
效果:
p:nth-child(3n){background-color:red;}
效果:
.item:nth-of-type(3n){background-color:red;}
效果:
p:nth-child(3n){background-color:red;}
效果:
0 0
- CSS3 :nth-child() 与:nth-of-type()
- CSS3之nth-child与nth-of-type
- CSS3::nth-child与:nth-of-type区别
- nth-child()与nth-of-type()区别
- CSS3 :nth-child() ,nth-of-type(),nth-last-child() ,nth-last-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-child(n)与:nth-of-type(n)的区别
- :nth-child(n)与:nth-of-type(n)的区别
- CSS :nth-child与:nth-of-type选择器
- nth-child和nth-of-type区别
- nth-child vs nth-of-type
- 浅谈:nth-child和:nth-of-type
- :nth-child和:nth-of-type
- CSS3子元素选择方法nth-child和nth-of-type
- Android annotations 框架
- 在table设置max-width以及min-width兼容问题和解决方案
- 关于float
- 学习方法
- 安卓下UC浏览器的字体变大bug
- CSS3 :nth-child() 与:nth-of-type()
- 文茵老师简介
- 关于margin上下重叠的问题
- 关于null与undefined
- javascript原生小练习(一)--tab切换、getClassName、addClass、removeClass
- 问题链接:UVA10976 Fractions Again?
- [319]Bulb Switcher
- 《数据库系统概论》学习总结
- 2. JMeter中非常重要的几个概念