选择器的使用(nth-of-type和nth-last-of-type选择器)
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<style type="text/css">
/*h2:nth-child(odd) {
background-color:yellow;
}
h2:nth-child(even) {
background-color:limegreen;
}*/
/*当父元素是列表时,因为列表中可能有列表项目一种子元素,所以不会有问题,而当父元素是<div>时,因为div中包含多种子元素,所以会出现问题。*/
h2:nth-of-type(odd) {
background-color:red;
}
h2:nth-of-type(even) {
background-color:skyblue;
}
</style>
</head>
<body>
<div>
<h2>文章标题A</h2>
<p>文章正文。</p>
<h2>文章标题B</h2>
<p>文章正文。</p>
<h2>文章标题C</h2>
<p>文章正文。</p>
<h2>文章标题D</h2>
<p>文章正文。</p>
</div>
</body>
</html>
出现问题:
解决问题:
选择器的使用(nth-of-type和nth-last-of-type选择器)的更多相关文章
- The conversion of a varchar data type to a datetime data type resulted in an out-of-range value
刚刚有在程序中,传递一个空值至MS SQL Server数据库,这个值的数据类型为DATETIME执行时,它却发生了如标题提示的异常:The conversion of a varchar data ...
- 【spring boot】spring boot 前台GET请求,传递时间类型的字符串,后台无法解析,报错:Failed to convert from type [java.lang.String] to type [java.util.Date]
spring boot 前台GET请求,传递时间类型的字符串,后台无法解析,报错:Failed to convert from type [java.lang.String] to type [jav ...
- Failed to register: Error: fabric-ca request register failed with errors [[{"code":0,"message":"No identity type provided. Please provide identity type"}]]解决方案
I try to run sample application as stated here : http://hyperledger-fabric.readthedocs.io/en/release ...
- 解决Type safety: The expression of type List needs
解决Type safety: The expression of type List needs unchecked conversion to conform to 在方法前加上这句话就可以了@Su ...
- No converter found capable of converting from type [java.lang.String] to type [java.util.Map<java.lang.String, org.springframework.boot.logging.LogLevel>]
java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.conte ...
- 报错The "chunk" argument must be one of type string or Buffer. Received type object
报错内容: TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be one of type string or ...
- No converter found capable of converting from type [java.lang.String] to type [java.util.Map<java.lang.String, java.lang.String>]
java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.conte ...
- Jpa自定义查询报错(Failed to convert from type [java.lang.Object[]] to type)
Jpa自定义查询报错 问题背景 今天遇到一个奇怪的报错"Failed to convert from type [java.lang.Object[]] to type",这个报错 ...
- 一种封装Retrofit的方法,可以自动解析Gson,回避Method return type must not include a type variable or wildcard: retrofit2.Call<T>的问题
封装目的:屏蔽底层实现,提供统一接口,并支持Gson自动转化 最初封装: //请求方法 interface RequestListener { interface PostListener { @PO ...
- Failed to convert from type [java.lang.String] to type [java.util.Date] for value '2020-02-06'; nested exception is java.lang.IllegalArgumentException]解决
今天做springbook项目前端输入日期传到数据库保存报了一下错误 Whitelabel Error Page This application has no explicit mapping fo ...
随机推荐
- vue-router: $router.push遇到的问题
如下图使用path时,跳转路由后的页面this.$route.params为undefined 改为name时,this.$route.params可以正确获取数据,如下图: 此为官方定义的固定搭配: ...
- Java字符串操作方法集
常用Java字符串操作方法 String s="Hello" String s2="World" 操作 方法 使用方法 结果 字符串截取 substring ...
- testlink 从1.8.5 升级到 1.9.8
step1:备份原 1.8.5 的数据库. step2:分别下载 1.9.0 / 1.9.3 / 1.9.8 的安装包. step3:分别解压 1.9.0 / 1.9.3 / 1.9.8 成3 ...
- iOS---iPad开发及iPad特有的特技
iPad开发简单介绍 iPad开发最大的不同在于iPhone的就是屏幕控件的适配,以及横竖屏的旋转. Storyboard中得SizeClass的横竖屏配置,也不支持iPad开发. 1.在控制器中得到 ...
- mysql 插入多条记录,重复值不插入
只去除主键与唯一索引的字段,字段为null时 是可以重复插入的domo: insert ignore into table_name(email,phone,user_id) values('test ...
- linux 10201 ASM RAC 安装+升级到10205
准备环境的时 ,要4个对外IP,2个对内IP 不超过2T,,一般都用OCFS 高端存储适合用ASM linux10G安装的时候,安装的机器时间要小于等于(如果是等于要严格等于)第二个机器的时间(只有l ...
- Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>' 点开错误的文 ...
- extjs中Store和grid的刷新问题
问题1:Store.load() 和Store.setproxy()区别 问题2:修改后的Grid 更新: Store.reload() 问题3,store删除后刷新会出问题 Store移除一行:St ...
- 零基础入门学习Python(1)--我和Python的第一次亲密接触
前言 最近在学习Python编程语言,于是乎就在网上找资源.其中小甲鱼<零基础入门学习Python>试听了几节课,感觉还挺不错,里面的视频都是免费下载,小甲鱼讲话也挺幽默风趣的,所以呢,就 ...
- PHP:图片上传
文章来源:http://www.cnblogs.com/hello-tl/p/7593033.html <?php class TL_Update_File{ private $file = n ...