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= ...
随机推荐
- shell--管道命令(pipe)
管道命令使用的是“|”这个界定符号 管道命令“|”仅能处理经由前面一个命令传来的正确信息,也就是standard output的信息,对于standard error并没有直接处理的能力 每个管道后面 ...
- 50行代码实现缓存,JAVA内存模型原理
遇见这样的高人怎么办??下面是一个简单缓存的实现,相当牛叉!自己看吧,只有50行代码. 摘自:http://www.oschina.net/code/snippet_55577_3887 import ...
- Eclipse+Maven远程部署项目到Tomcat中
使用maven的自动部署功能可以很方便的将maven工程自动打包并且部署到远程tomcat服务器,省去一些繁琐的操作,节省大量时间. 我使用的tomcat版本是8.5,tomcat7和tomcat8都 ...
- spring的jar包maven地址,统一下载很方便
最近spring的官网改版了,想下个jar包,还得maven什么的,由于急于开发,懒得整那些个啦,在网上找了个spring的各版本的jar包地址,特此共享下: http://maven.springf ...
- Ios 调用Appstore 下载界面 [[UIApplication sharedApplication] openURL
http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?mt=8&id=286274367 id = itunesconn ...
- 利用 MySQL 技能学习 DB2 Express: DB2 与 MySQL 的管理任务和基本任务
原文地址:http://www.ibm.com/developerworks/cn/data/library/techarticles/dm-0602tham2/index.html 简单介绍 管理不 ...
- Python CODE——Nonblocking I/O client AND Delaying Server
#!Nonblocking I/O - Chapter 5 -pollclient.py import socket,sys,select port=51423 host='localhost' sp ...
- iOS之基于FreeStreamer的简单音乐播放器(模仿QQ音乐)
代码地址如下:http://www.demodashi.com/demo/11944.html 天道酬勤 前言 作为一名iOS开发者,每当使用APP的时候,总难免会情不自禁的去想想,这个怎么做的?该怎 ...
- 网页中多一些常见效果之伸缩菜单(主要是学习js的书写方法)
效果如下图: 代码很简单,如下: <!doctype html> <html lang="en"> <head> <meta charse ...
- "《 Serial Drivers 》by Alessandro Rubini" 学习笔记
Introduction to "serial device driver" (My study note) 膜拜大神的作品. Standing on the should ...