CSS Combinators Pseudo Class and CSS Pseudo Element
CSS Combinators Pseudo Class and CSS Pseudo Element
pseudo-element
element element div p Selects all <p> elements inside <div> elements
element>element div > p Selects all <p> elements where the parent is a <div> element
Selects the first <p> element that are placed immediately after <div>
element+element div + p
elements
element1~element2 p ~ ul Selects every <ul> element that are preceded by a <p> element
:first-child p:first-child Selects every <p> elements that is the first child of its parent
:first-of-type p:first-of-type Selects every <p> element that is the first <p> element of its parent
:in-range input:in-range Selects <input> elements with a value within a specified range
:lang(language) p:lang(it) Selects every <p> element with a lang attribute value starting with "it"
:last-child p:last-child Selects every <p> elements that is the last child of its parent
:last-of-type p:last-of-type Selects every <p> element that is the last <p> element of its parent
:nth-child(n) p:nth-child(2) Selects every <p> element that is the second child of its parent
Selects every <p> element that is the second child of its parent,
:nth-last-child(n) p:nth-last-child(2) counting from the last child
Selects every <p> element that is the second <p> element of its parent,
:nth-last-of-type(n) p:nth-last-of-type(2) counting from the last child
:nth-of-type(n) p:nth-of-type(2) Selects every <p> element that is the second <p> element of its parent
:only-of-type p:only-of-type Selects every <p> element that is the only <p> element of its parent
:only-child p:only-child Selects every <p> element that is the only child of its parent
:out-of-range input:out-of-range Selects <input> elements with a value outside a specified range
Reference :
https://www.w3schools.com/css/css_combinators.asp
https://www.w3schools.com/css/css_pseudo_elements.asp
https://www.w3schools.com/css/css_pseudo_classes.asp