nth-child 和 nth-of-type 的区别
css3中有两个新的选择器可以选择父元素下对应的子元素,一个是:nth-child 另一个是:nth-of-type,它们2个的区别是:
nth-of-type为什么要叫:nth-of-type?因为它是以"type"来区分的。也就是说:
ele:nth-of-type(n)是指父元素下第n个ele元素,
ele:nth-child(n)是指父元素下第n个元素且这个元素为ele,若不是,则选择失败
<section>
<div>我是一个普通的div标签</div>
<p>我是第1个p标签</p>
<p>我是第2个p标签</p> <!-- 希望这个变红 -->
</section> p:nth-child(2) { color: red; } 我是第1个p标签 变红 p:nth-of-type(2) { color: red; } 我是第2个p标签 变红
nth-child 和 nth-of-type 的区别的更多相关文章
- ASP.NET控件<ASP:Button /> html控件<input type="button">区别联系
ASP.NET控件<ASP:Button />-------html控件<input type="button">杨中科是这么说的:asp和input是一样 ...
- Html中,id、name、class、type的区别
<input type="text" name="name" id="name" class="txt"> ...
- isinstance与type的区别
1.isinstance()内置函数 python中的isinstance()函数是python的内置函数,用来判断一个函数是否是一个已知类型.类似type. 2.用法: isinstance(obj ...
- python isinstance()与type()的区别
例如在继承上的区别: isinstance() 会认为子类是一种父类类型,考虑继承关系. type() 不会认为子类是一种父类类型,不考虑继承关系. class A: pass class B(A): ...
- class kind type sort区别
class多用于 级别比如高级货就是 first class,primary class等等,以此类推kind 和sort 基本一样,就像你说的,译为 种类,what kind of疑问,回答时用so ...
- python 内建函数isinstance的用法以及与type的区别
isinstance是Python中的一个内建函数 语法: isinstance(object, classinfo) 如果参数object是classinfo的实例,或者object是class ...
- isinstance 和 type 的区别
class A: pass class B(A): pass isinstance(A(), A) # returns True type(A()) == A # returns True isins ...
- 【学习总结】Python-3- 类型判断之 isinstance 和 type 的区别
菜鸟教程-Python3-基本数据类型 关于类型查询: type() 函数:可以用来查询变量所指的对象类型 用 isinstance()函数:判断是否是某个类型 两者的区别: type()不会认为子类 ...
- const type& 与 type& 的区别
const type& 与 type& 是C/C++编程中容易混淆的两个知识点,现在以 cont int& 与 int& 为例讲解: 1.int& 讲解 int ...
- form表单重复提交,type=“button”和type=“submit”区别
公司测试提了一个项目后台在IE浏览器下(360,firefox就没问题)出现数据重复的问题,调试了好久终于发现问题所在,也不知道是谁写的代码,醉醉的.... 错误地点: <input type= ...
随机推荐
- Tomcat中实现IP访问限制
打开tomcat6\conf\server.xml文件 如果是要限制整个站点别人不能访问,则要将 <Valve className="org.apache.catalina.valve ...
- iOS 带IAP提交注意事项及无法submit for review的解决方案
原地址:http://blog.sina.com.cn/s/blog_71ce775e0101dl4a.html 最近项目接触到了苹果的程序内购(IAP),碰到不少问题,参考了很多帖子才得以解决.在此 ...
- Vue 全家桶 + Electron 开发的一个跨三端的应用
代码地址如下:http://www.demodashi.com/demo/11738.html GitHub Repo:vue-objccn Follow: halfrost · GitHub 利用 ...
- C-C Primer Plus阅读笔记
常用头: stdio.h string.h inttypes.h limits.h float.h 1.打印short.long.long long和unsigned #include <std ...
- Spring AOP事务管理(使用切面把事务管理起来)
在<Spring Transaction 分析事务属性(事务的基本概念.配置)>基础上 http://blog.csdn.net/partner4java/article/details/ ...
- Spring核心项目及微服务架构方向
spring 顶级项目:Spring IO platform:用于系统部署,是可集成的,构建现代化应用的版本平台,具体来说当你使用maven dependency引入spring jar包时它就在工作 ...
- 在CentOS 6.3中安装拼音输入法
安装:su root yum install "@Chinese Support" // 安装中文输入法 exit安装完毕,在“系统-->首选项”会看到“输入法”一 ...
- python-class(5)
#!/usr/bin/env python #-*- coding:utf-8 -*- ############################ #File Name: class5.py #Auth ...
- PHP图片识别成文字
http://apistore.baidu.com/apiworks/servicedetail/146.html 分类: php2011-- : 3576人阅读 评论() 收藏 举报 phpfunc ...
- 小程序swiper配置参数使用
不管什么项目,一个轮播是基本少不了的,现在就来踩下微信小程序的swiper吧! 首先打开文档,可以看到下面这些参数:(https://mp.weixin.qq.com/debug/wxadoc/dev ...