CSS选择子简明参考
Type Selector
Example
h1 { }
Description
Selects an HTML tag/element.
Universal selector
Example
* { }
Description
Selects everything in the document (or inside the parent element if it is being chained together with another element and a descendant combinator, for example).
Class selector
Example
.box { }
Description
Matches elements based on the contents of their class attribute.
id selector
Example
#unique { }
Description
Matches an element based on the value of its id attribute. In order for the element to be selected, its ID attribute must match exactly the value given in the selector.
Attribute selector
Example
a[title] { }
p[title="myTitle"] { }
Description
Matches elements based on the presence or value of a given attribute.
Pseudo-class selector
Example
p:first-child { }
a:hover { }
Description
Specifies a special state of the selected element(s).
Pseudo-element selector
Example
p::first-line { }
Description
Lets you style a specific part of the selected element(s).
Descendant combinator
Example
h1 p { }
Description
Matched by the second selector are selected if they have an ancestor (parent, parent's parent, etc) element matching the first selector.
Child combinator
Example
h1 > p { }
Description
Matches only those elements matched by the second selector that are the direct children of elements matched by the first.
Adjacent sibling combinator
Example
img + p { }
Description
Matches the second element only if it immediately follows the first element, and both are children of the same parent element.
General sibling combinator
Example
img ~ p { }
Description
Matches the second element only if it follows the first element (though not necessarily immediately), and both are children of the same parent element.
CSS选择子简明参考的更多相关文章
- CSS选择符、属性继承、优先级算法以及CSS3新增伪类、新特性
CSS 选择符有哪些?哪些属性可以继承?优先级算法如何计算? CSS3新增伪类有那些?CSS新增了哪些特性?下面我整理了一些,仅供参考. CSS 选择符: 1) id选择器(# myid) ...
- 30个你必须记住的CSS选择符
所以你学会了基础的id,类和后代选择符,然后你就一直用它们了吗?如果是这样,你丢失了(css的)巨大的灵活性.在本文中提到的很多选择器属于CSS3规范的一部分,因此,只有在现代浏览器中才可使用. 1. ...
- CSS选择符详解
一.类型选择符 什么是类型选择符?指以网页中已有的标签类型作为名称的行径符.body是网页中的一个标签类型,div,p,span都是. 如下: body {} div {} p {} span {} ...
- 编写高效的CSS选择符(节选)
最右边优先 css选择符是从右向左进行匹配的. 样式系统从最右边的选择符开始向左匹配规则.只要当前的选择符的左边还有其他选择符,样式系统就会继续向左移动,直到找到和匹配的元素,或者因为不匹配而退出. ...
- CSS选择符详解之关系选择符篇
原文:http://www.chinaz.com/web/2012/1017/278553.shtml 相信大家都对CSS选择符都不陌生,选择符包含:元素选择符.关系选择符.属性选择符.伪类选择符.伪 ...
- 整理CSS选择符
1.星号选择器 ;; } 星号选择器将匹配页面里的每一个元素.很多开发者使用这个技巧将外边距和内边距重置为零.虽然在快速测试时这确实很好用,但我建议你永远不要再生产代码中使用它.它给浏览器带来大量不必 ...
- [css选择器]总结:IE6不支持的CSS选择符
转载地址:https://www.wenjiwu.com/doc/zvsbii.html.此文最后也给出了原文地址,但是我点击过去发现是什么赌博彩票的地址,360也弹出小心的提示,所以这里只给出了我转 ...
- CSS选择器之基本选择器总结
一.元素选择器(所有浏览器支持) 元素选择器(标签名选择器)其实就是文档的元素,如html,body,p,div等等, 下面例子中选择了span元素,并设置了字体颜色为红色. <body> ...
- jq选择子元素
jq选择子元素 一.获取父级元素 1. parent([expr]): 获取指定元素的所有父级元素 <div id="par_div"><a id="h ...
随机推荐
- BigDecimal加减乘除计算
一.简述 java.math.BigDecimal不可变的.任意精度的有符号十进制数.BigDecimal 由任意精度的整数非标度值(unscaledValue)和32位的整数标度(scale)组成. ...
- JUnit 4.x 与 5.x 的区别?
区别项 4.x 5.x 手动把测试和测试方法声明为public 需要 不需要 @Test 与JUnit 4的@Test注解不同的是,它没有声明任何属性,因为JUnit Jupiter中的测试扩展是基于 ...
- 修改linux环境变量导致系统命令不可用,-bash: xx: command not found
QQ群里发现有群友对jmeter分布式环境搭建有困惑,于是决定写一篇. 首先我在安装好的linux虚拟机里面安装jdk,在修改环境变量(vim /etc/profile)后,导致系统命令不可用,-ba ...
- wordpress不同分类调用不同的模板
今天网友问ytkah:wordpress不同分类如何调用不同的模板.我们知道in_category() 函数可以通过分类别名或ID判断当前文章所属的分类,而且可以直接在循环(Loop)内部和外部使用. ...
- Hbase扩展
1 HBase在商业项目中的能力 每天: 1) 消息量:发送和接收的消息数超过60亿 2) 将近1000亿条数据的读写 3) 高峰期每秒150万左右操作 4) 整体读取数据占有约55%,写入占有45% ...
- gtibase rpm包制作
gitbase 是一个很不错的代码分析工具,我们可以直接使用sql来分析团队的代码,以下是rpm 包的制作 简单说明 rpm 包的制作使用了fpm 一个简单,方便可以跨平台的软件包制作工具 gitba ...
- netflix conductor 学习(一)docker-compose 运行
为了方便学习以及使用netflix conductor 基于官方的dockerfile,构建了server 以及ui 的容器镜像并push dockerhub 环境准备 官方docker-compos ...
- .Net 下基于Redlock redis 分布式锁实现
Redlock-cs (C#/.NET implementation). RedLock.net (C#/.NET implementation). Includes async and lock e ...
- 第五届新疆ACM H-虚无的后缀
来源 第五届新疆省ACM-ICPC程序设计竞赛nowcoder重现赛 H-虚无的后缀 思路1 好菜哦. 首先后缀零的个数最多,我们只需要考虑他的质因子2和5的个数就行了(存为a,b). 因为其他因子对 ...
- pytest . class
#在当前测试类的开始与结束执行. setup_class teardown_class #在每个测试方法开始与结束执行. setup teardown #在每个测试方法开始与结束执行,与setup/t ...