Home  >  Article  >  Web Front-end  >  所有CSS选择器的意义及其兼容性,你都知道吗_html/css_WEB-ITnose

所有CSS选择器的意义及其兼容性,你都知道吗_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:57:28887browse

作为一名WEB前端开发人员,准确地掌握每个CSS选择器的意义及其兼容性,可以做为进阶的第一步!


CSS选择器可以分为五类:元素选择器、关系选择器、属性选择器、伪类选择器和伪对象选择器。

一、元素选择器

元素选择器共有4个:


二、关系选择器

关系选择器共有4个:



三、属性选择器

属性选择器共有7个:


注:这里的“字符串”包括以空格分隔的单词和整个字符串。如:以”val”开头的“字符串”包括:”val”、”val abc”、”valabc”。


四、伪类选择器

伪类选择器共有23个(不考虑打印样式):



五、伪对象选择器

伪对象选择器共有5个:

注: CSS3将伪对象选择器前面的单个冒号修改为双冒号,但以前的写法仍然有效。E:before和E:after要与content属性一起使用,且content的值要加引号。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn