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 ...
随机推荐
- 项目Beta冲刺总结随笔
班级:软件工程1916|W 作业:项目Beta冲刺 团队名称:SkyReach 目标:Beta冲刺Day2 项目Github地址 团队博客汇总 队员学号 队员姓名 个人博客地址 备注 22160010 ...
- Opencv 初探 常用API
一.介绍 OpenCV是计算机视觉领域应用最广泛的开源工具包,基于C/C++,支持Linux/Windows/MacOS/Android/iOS,并提供了Python,Matlab和Java等语言的接 ...
- python面试题&练习题之函数
1.写函数,接收两个数字参数,返回最大值例如:传入:10,20返回:20 def res_max(number1,number2): l1 = [] l1.append(number1) l1.app ...
- datetime.now()提示没有now方法
py3.6 导入方法是 from datetime import datetime 在使用datetime.now()的时候报错,说没有now 在保存module的create_time字段的时候,提 ...
- 如何进行seo优化要点总结
一.搜索引擎工作原理 当我们在输入框中输入关键词,点击搜索或查询时,然后得到结果.深究其背后的故事,搜索引擎做了很多事情. 在搜索引擎网站,比如百度,在其后台有一个非常庞大的数据库,里面存储了海量的关 ...
- day03 数据基础
1.列举字符串,列表,元组,字典每个常用的五个方法 字符串: strip() , lstrip(),restrip() count(),index(),find() startswith,endswi ...
- JavaScript 箭头函数
ES6新标准增加了一种新的函数,箭头函数. x=>x*x 相当于: function (x){ return x*x; } 如果参数不是一个,就需要用括号()括起来: // 两个参数:var t ...
- Linux搜索所有文件中的内容
主要命令如下: grep -rn "{填写关键字}" * : 表示当前目录所有文件,也可以是某个文件名-r 是递归查找-n 是显示行号-R 查找所有文件包含子目录-i 忽略大小写- ...
- OO助教的退休感想
深夜失眠+刚赶完火车的胡言乱语,切莫当真,择日修改 一年前,我在学姐的怂恿鼓励下,加上了吴老师的微信,表达了想担任下学期的OO助教的想法.三天后,我到新主楼参加OO助教的面试,其实还是蛮紧张的,毕竟自 ...
- Net core学习系列(十)——Net Core配置
一.前言 选项(Options)模式是对配置(Configuration)的功能的延伸.在12章(ASP.NET Core中的配置二)Configuration中有介绍过该功能(绑定到实体类.绑定至对 ...