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选择子简明参考的更多相关文章

  1. CSS选择符、属性继承、优先级算法以及CSS3新增伪类、新特性

    CSS 选择符有哪些?哪些属性可以继承?优先级算法如何计算? CSS3新增伪类有那些?CSS新增了哪些特性?下面我整理了一些,仅供参考. CSS 选择符: 1)      id选择器(# myid) ...

  2. 30个你必须记住的CSS选择符

    所以你学会了基础的id,类和后代选择符,然后你就一直用它们了吗?如果是这样,你丢失了(css的)巨大的灵活性.在本文中提到的很多选择器属于CSS3规范的一部分,因此,只有在现代浏览器中才可使用. 1. ...

  3. CSS选择符详解

    一.类型选择符 什么是类型选择符?指以网页中已有的标签类型作为名称的行径符.body是网页中的一个标签类型,div,p,span都是. 如下: body {} div {} p {} span {} ...

  4. 编写高效的CSS选择符(节选)

    最右边优先 css选择符是从右向左进行匹配的. 样式系统从最右边的选择符开始向左匹配规则.只要当前的选择符的左边还有其他选择符,样式系统就会继续向左移动,直到找到和匹配的元素,或者因为不匹配而退出. ...

  5. CSS选择符详解之关系选择符篇

    原文:http://www.chinaz.com/web/2012/1017/278553.shtml 相信大家都对CSS选择符都不陌生,选择符包含:元素选择符.关系选择符.属性选择符.伪类选择符.伪 ...

  6. 整理CSS选择符

    1.星号选择器 ;; } 星号选择器将匹配页面里的每一个元素.很多开发者使用这个技巧将外边距和内边距重置为零.虽然在快速测试时这确实很好用,但我建议你永远不要再生产代码中使用它.它给浏览器带来大量不必 ...

  7. [css选择器]总结:IE6不支持的CSS选择符

    转载地址:https://www.wenjiwu.com/doc/zvsbii.html.此文最后也给出了原文地址,但是我点击过去发现是什么赌博彩票的地址,360也弹出小心的提示,所以这里只给出了我转 ...

  8. CSS选择器之基本选择器总结

    一.元素选择器(所有浏览器支持) 元素选择器(标签名选择器)其实就是文档的元素,如html,body,p,div等等, 下面例子中选择了span元素,并设置了字体颜色为红色. <body> ...

  9. jq选择子元素

    jq选择子元素 一.获取父级元素 1. parent([expr]): 获取指定元素的所有父级元素 <div id="par_div"><a id="h ...

随机推荐

  1. canvas详解---绘制弧线

    Draw an arc context.arc(centerx,centery,radius,startingAngle,endingAngle,anticlockwise=false); 参数一是圆 ...

  2. 《团队名称》第八次团队作业:Alpha冲刺day3

    项目 内容 这个作业属于哪个课程 2016计算机科学与工程学院软件工程(西北师范大学) 这个作业的要求在哪里 实验十二 团队作业8-软件测试与ALPHA冲刺 团队名称 快活帮 作业学习目标 (1)掌握 ...

  3. JSR303/JSR-349,hibernate validation,spring validation 之间的关系

    JSR303是一项标准,JSR-349是其的升级版本,添加了一些新特性,他们规定一些校验规范即校验注解,如@Null,@NotNull,@Pattern,他们位于javax.validation.co ...

  4. 1.使用FluentNHibemate 操作数据库,添加映射到数据库

    1.创建个控制台工程MySQLDateBase 2.工程中添加Fluent NHibernate映射工具 点击管理NuGet程序包,点击浏览,搜索Fluent NHibernate 点击安装..安装完 ...

  5. GeoIP简介与资源,定位经纬度,获取用户IP

    所谓GeoIP,就是通过来访者的IP,定位他的经纬度,国家/地区,省市,甚至街道等位置信息.这里面的技术不算难题,关键在于有个精准的数据库.有了准确的数据源就奇货可居赚点小钱,可是发扬合作精神,集体贡 ...

  6. java 解决nginx代理的跨域访问问题

    一.什么是跨域 跨域是浏览器对JavaScript同源策略的限制 二.什么情况下会产生跨域 域名不同 wwww.baidu.com www.jd.com 域名相同,访问的端口不同 wwww.baidu ...

  7. PostgreSQL 慢查询SQL跟踪

    PostgreSQL 开启慢SQL捕获在排查问题时是个很有效的手段.根据慢SQL让我在工作中真正解决了实际问题,很有帮助. PostgreSQL 日志支持的输出格式有 stderr(默认).csvlo ...

  8. uni-app下拉刷新加载刷新数据

    onPullDownRefresh监听该页面用户下拉刷新事件需要在 pages.json 里开启 enablePullDownRefresh "globalStyle": { } ...

  9. React-HelloWorld

    React-HelloWorld 最简单的React示例如下: ReactDOM.render( <h1>Hello,world!</h1>, document.getelem ...

  10. linux高性能服务器编程 (四) --TCP/IP通信案例

    第四章 TCP/IP通信案例 HTTP代理服务器的大致工作原理        在HTTP通信链上,客户端和服务器之间通常存在某些中转代理服务器.它们提供对目标资源的中转访问.一个HTTP请求可能被多个 ...