Home  >  Article  >  Web Front-end  >  Do you know the meaning and compatibility of all CSS selectors_html/css_WEB-ITnose

Do you know the meaning and compatibility of all CSS selectors_html/css_WEB-ITnose

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

As a WEB front-end developer, accurately understanding the meaning and compatibility of each CSS selector can be the first step to advance!


CSS selectors can be divided into five categories: element selectors, relationship selectors, attribute selectors, pseudo-class selectors and pseudo-object selectors.

1. Element Selector

There are 4 element selectors:


2. Relationship selector

There are 4 relationship selectors:



3. Attribute Selector

There are 7 attribute selectors in total:


Note: The " character here "String" includes space-separated words and entire strings. For example: "Strings" starting with "val" include: "val", "val abc", "valabc".


4. Pseudo-class selectors

There are 23 pseudo-class selectors (regardless of printing style):



5. Pseudo-object selector

There are 5 pseudo-object selectors:

Note: CSS3 changes the single colon in front of the pseudo-object selector to a double colon, but the previous writing method is still valid. E:before and E:after should be used together with the content attribute, and the value of content should be quoted.

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