Home >Web Front-end >Front-end Q&A >What does css selector mean?
css selectors can help us select tags that need to be styled. CSS selectors include: 1. id selector; 2. Class selector; 3. Label selector; 4. Adjacent selector ; 5. Child selector; 6. Descendant selector; 7. Wildcard selector, etc.
The operating environment of this tutorial: windows7 system, css3 version, thinkpad t480 computer.
css selector (selector) can help us select the tags that need to be styled. Each CSS style definition consists of two parts, in the following form: selector {style} The part before {} is the "selector".
The selector specifies the object of the "style" in {}, that is, which elements in the web page the "style" acts on.
What are the selectors (selectors) of CSS?
id selector (for example # myid): matches any element with an ID equal to "myid".
Class selector (eg.myclassname): matches any element whose class is equal to "myclassname".
Label selector (eg. div, h1, p): selects all elements with the specified element name .
Adjacent selector (e.g. h1 p): used to select (not internally) the element immediately following the specified first element.
Child selector (e.g. ul > li): used to select elements with specific parent elements, for example, select all
Descendant selector (example: li a): used to select elements inside the element.
Wildcard selector (*): matches any element.
Attribute selector (a[rel = "external"], etc.): Select elements with specific attributes.
Pseudo-class selector (a: hover, li:nth-child, etc.)
For more programming-related knowledge, please visit: Programming Teaching! !
The above is the detailed content of What does css selector mean?. For more information, please follow other related articles on the PHP Chinese website!