CSS Selector
Learning Essentials:
1. Selector Hub
2. Basic Selector
3. Composite Selector
4. Pseudo element Selector
This chapter focuses on the CSS selector in HTML5, where you navigate to the element where you want to set the style. The current version of the CSS selector has been upgraded to the third generation, the CSS3 selector. The CSS3 selector provides more and richer selector methods, which are divided into three major categories.
A Selector hub
This lesson is mainly about three selectors: basic selector, composite selector, and pseudo-element selector, as follows:
Selector Name Description CSS version
* Universal Selector selects all elements 2
<type> element Selector Select element of the specified type 1
#<id> ID Selector Select element of the specified ID attribute 1
The .<class> class selector selects the element that specifies the class attribute 1
[attr] Series Property Selector Select the element that specifies the Attr property 2 ~ 3
S1,s2,s3 ... Grouping selectors select elements of multiple selectors 1
S1 s2 descendant Selector Select the descendant element of the specified selector 1
S1 > S2 Sub-selector Select the child element of the specified selector 2
S1 + s2 Adjacent sibling selector Select the element adjacent to the specified selector 2
S1 ~ S2 Ordinary Brother Selector Select the element following the specified selector 3
:: First-line pseudo-Element selector selects the first line of block-level element text 1
:: First-letter pseudo-Element selector selects the first letter of block-level element text 1
:: Before pseudo element selector insert content before selecting elements 2
:: After pseudo element selector selection element Insert content 2
70th section, CSS Selector