选择器的使用(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 ...
随机推荐
- Android开发中使用startActivityForResult()方法从Activity A跳转Activity B出现B退出时A也同时退出的解决办法
最近一个 App 中用到了 startActivityForResult() 方法,使用的时候却出现了一些问题,比如我在 Activity A 中调用该方法向 Activity B 中跳转,如果 B ...
- 【C++】异常简述(一):C语言中的异常处理机制
人的一生会遇到很多大起大落,尤其是程序员. 程序员写好的程序,论其消亡形式无非三种:无疾而终.自杀.他杀. 当然作为一名程序员,最乐意看到自己写的程序能够无疾而终,因此尽快的学习异常处理机制是非常重要 ...
- 翻译:高级t - sql第1级的阶梯:使用交叉连接来引入高级t - sql
高级t - sql第1级的阶梯:使用交叉连接来引入高级t - sql 源于:格雷戈里·拉森,2016/02/19(首次出版:2014/12/17 翻译:刘琼滨 谢雪妮 徐雅莉 赖慧芳 链接:http: ...
- HDU_3792_(素数筛+树状数组)
Twin Prime Conjecture Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...
- Java并发——volatile关键字的使用
volatile关键字的使用volatile关键字原理适合使用volatile关键字的情况当且仅当满足以下所有条件时,才==应该==使用volatile关键字:volatile关键字的作用volati ...
- css 动态导入css文件 @import 动态js加载 都是静态的
@import "http://apps.bdimg.com/libs/bootstrap/3.3.4/css/bootstrap.css" /*-防止各大cdn公共库加载地址失效 ...
- CAD绘制固定圆形云线标注(网页吧)
js中实现代码说明: function DoCloudCircleCommentFix() { var comment = mxOcx.NewEntity("IMxDrawComment&q ...
- Ubuntu16.04 python3.4.3升级到python3.7.1
python有两个版本,一个2版本,使用的是python:另一个是3版本,使用的是python3. 简易安装python后得到的3版本的版本号是python3.4.3. 可以使用下面的命令查看py版本 ...
- 去掉PhpStorm打开自动启动的项目
有时候启动的项目很大,导致很卡,而且在编辑器中更改也没效果,简单暴力的办法 找到项目的目录,删除其中的.idea文件夹
- 阿里云部署flask
https://www.cnblogs.com/Ray-liang/p/4173923.html