Specificity Broken Down
Specificity: How it works
- 0-0-0: Global selector
- 1-0-0: ID selector
- 0-1-0: Class selector (Also attribute selector & pseudoclass)
- 0-0-1: Element Selector
- Descendant Selector Combinator (' ')
- Child Selector Combinator ('>')
- Sibling Selector Combinator ('~')
- Adjacent Sibling Selector Combinator ('+')
Selector | Example | Description |
---|---|---|
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 |
element + element | div + p | Selects the first <p> element that are placed immediately after <div> elements |
element ~ element | p ~ ul | Selects every <ul> element that are preceded by a <p> element |
EACH ONE TEACH ONE AGAIN :)
Methods - each group presents
What is it?
Demonstrate yourself using document.querySelector or document.querySelectorAll to select an element or elements with it or use it inside of css to style the page
share code in slack
GROUP 1
:first-child
:last-child
:only-child
:invalid
Group 2
:hover
:checked
:not
Group 3
::before
::after
::first-line
Group 4
:nth-of-type
:first-of-type
:only-of-type