:nth-child和:nth-of-type的区别
来源:互联网 发布:淘宝一航通讯是卖假货 编辑:程序博客网 时间:2024/06/04 18:16
:nth-of-type为什么要叫:nth-of-type?因为它是以"type"来区分的。也就是说:ele:nth-of-type(n)是指父元素下第n个ele元素,
而ele:nth-child(n)是指父元素下第n个元素且这个元素为ele,若不是,则选择失败。
而ele:nth-child(n)是指父元素下第n个元素且这个元素为ele,若不是,则选择失败。
这里附上一个小例子:
<div>
<ul class="demo">
<p>zero</p>
<li>one</li>
<li>two</li>
</ul>
</div>
上面这个例子,.demo li:nth-child(2)选择的是<li>one</li>节点,
而.demo li:nth-of-type(2)则选择的是<li>two</li>节点。
0 0
- nth-child和nth-of-type区别
- :nth-child 和 :nth-type-of 的区别
- :nth-child 和 :nth-type-of 的区别
- CSS3中:nth-child和:nth-of-type的区别
- CSS3中:nth-child和:nth-of-type的区别
- :nth-child和:nth-of-type的区别
- 关于:nth-child和:nth-of-type的区别
- :nth-child和:nth-of-type的区别
- nth-child和nth-of-type的区别
- :nth-child和:nth-of-type的区别
- nth-of-type和nth-child的区别
- nth-of-type和nth-child的区别
- css3 :nth-child和:nth-of-type的区别
- css :nth-child和:nth-of-type的区别
- nth-child()与nth-of-type()区别
- css nth-child(n)和nth-of-type(n)区别
- css nth-child和nth-type-of 区别
- :nth-child(n)与:nth-of-type(n)的区别
- APP混淆全攻略
- Eclipse 安装 SVN 插件的两种方法
- JVM 诊断调优 CheatSheet
- 常用正则表达式大全
- Effective Modern C++ Item 7 总结:关于两种对象创建方法“()、{}”的区分
- :nth-child和:nth-of-type的区别
- Android仿今日头条视频列表播放
- kubenetes源码分析之DNS(六)
- 理解JAVA 中的代码单元与代码点
- C#保存文件、读取文件对话框
- 单调递增子序列(二)
- centon7上RPM安装Mysql5.5
- 十大经典排序算法
- gridview动态更改列数、行数、高度