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. 日志分析查看——grep,sed,sort,awk运用

    概述 我们日常应用中都离不开日志.可以说日志是我们在排查问题的一个重要依据.但是日志并不是写了就好了,当你想查看日志的时候,你会发现线上日志堆积的长度已经超越了你一行行浏览的耐性的极限了.于是,很有必 ...

  2. live-pusher属性值的改变

    例如:组件推流过程中,切换前后摄像头时,要改变mirror的值并使其生效: LivePusherContext = wx.createLivePusherContext() 1. LivePusher ...

  3. 欢迎访问阿里云Go Module代理仓库服务

    简介 go module公共代理仓库,代理并缓存go模块.你可以利用该代理来避免DNS污染导致的模块拉取缓慢或失败的问题,加速你的构建. 地址 https://mirrors.aliyun.com/g ...

  4. NSFileHandle类和NSFileManager,追加数据的操作

    NSFileHandle类主要对文件内容进行读取和写入操作 NSFileManager类主要对文件的操作(删除.修改.移动.复制等等) 常用处理方法 + (id)fileHandleForReadin ...

  5. tab吸顶的神奇-- css粘性属性

    position: -webkit-sticky; position: sticky; top: 0.86rem; //可以自定义设置大小 亲测,目前谷歌浏览器等都已经支持该属性.

  6. ent 基本使用十一 sql.DB 集成

    这个功能是github中大家提的比较多的一个,所以官方也暴露了相关的api 配置sql.DB 一种方式 package main ​ import ( "time" ​ " ...

  7. AsyncAPI 几个方便的工具

    AsyncAPI 类似openapi 也提供了一些周边工具 editor 类似openapi 的,但是目前官方已经不推荐使用了,推荐使用playground,以下是构建一个容器镜像 clone 代码 ...

  8. centos 部署的时候安装不上Mariadb,缺少依赖文件

    并不存在这个sock文件 使用systemctl status mariadb.service 查看报错信息 提示libsystemd.so.0文件不存在, 安装systemd-libs包,解决问题, ...

  9. Java程序设计学习知识点总结

    Java程序设计学习知识点总结 Java语言简单,面向对象,分布式,解释性,健壮,安全与系统无关,可移植,高性能,多线程,动态语言. 什么是框架 可以认为是某种应用的半成品,就是一组组件用来完善自己的 ...

  10. 部署oVirt4.2+Gluster超融合架构

    首先下载最新ovirt-node iso镜像 准备3台机器,配置为2核,16G内存,两块硬盘,1块100G装系统,1块300G做存储 node1.com(192.168.105.221) node2. ...