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 ...
随机推荐
- 20、Python常用模块sys、random、hashlib、logging
一.sys运行时环境模块 sys模块负责程序与python解释器的交互,提供了一系列的函数和变量,用于操控python的运行时环境. 用法: sys.argv:命令行参数List,第一个元素是程序本身 ...
- SpringBoot——报错总结
前言 记录SpringBoot的相关报错信息 错误 无法引入@ResponseBody和@RequestMapping("/") <dependency> <gr ...
- Keil5创建基于RTX的STM32工程(转载+自己的体会)
转载自:https://blog.csdn.net/u011976086/article/details/54342447#commentBox 之前使用过ucos,freertos,但是这个keil ...
- stm32软件编程的框架及注意事项——rtos篇
0.通常,嵌入式软件(这里指单片机系统)的框架千变万化,有带rtos的,也有裸机的. 0.1.写过带系统的,也写过裸机的,这里总结一下两个类型的框架,记录下自己的心得,主要是文字描述,框架图可以后期添 ...
- mysql 执行存储过程报错Prepared statement needs to be re-prepared
今日思语:不喜欢再见 说再见,因为有时明知道下一次再见已是遥遥无期或是不再见 错误如下: ERROR 1615 (HY000) at line 406 in file: 'update-mysql.s ...
- SQL盲注学习-布尔型
本次实验还是使用sqli-labs环境.在开始SQL盲注之前首先学习一下盲注需要用到的基础语法. 1.left()函数:left(str,lenth)它返回具有指定长度的字符串的左边部分. left( ...
- 第04组alpha冲刺(3/4)
队名:斗地组 组长博客:地址 作业博客:Alpha冲刺(3/4) 各组员情况 林涛(组长) 过去两天完成了哪些任务: 1.收集各个组员的进度 2.写博客 展示GitHub当日代码/文档签入记录: 接下 ...
- Impala 架构探索-Impala 系统组成与使用调优
要好好使用 Impala 就得好好梳理一下他得结构以及他存在得一些问题或者需要注意得地方.本系列博客主要想记录一下对 Impala 架构梳理以及使用上的 workaround. Impala 简介 首 ...
- GoCN每日新闻(2019-11-09)
GoCN每日新闻(2019-11-09) 1. Go语言发行10周年庆祝 https://blog.golang.org/10years2. 容器中某Go服务GC停顿经常超过100ms排查 https ...
- Pyhton学习的基础
函数->功能, 如print(),input(),range(), 方法->功能, 如index()(尽量不用此方法),find(),类里面的函数就叫做方法 容器->列表,字符串,元 ...