Selectors
~10 mins
Basic Selectors
CSS selectors identify specific HTML elements as targets for CSS styles.
| Selector | Description |
|---|---|
| * | Universal selector (all elements) |
| div | Tag selector (all elements) |
| .blue | Class selector (all elements with class blue) |
| .blue.red | All elements with class blue and red (a type of Compound selector) |
| #headline | ID selector (the element with "id" attribute set to headline) |
| :pseudo-class | All elements with pseudo-class |
| ::pseudo-element | Element that matches pseudo-element |
| :lang(en) | Element that matches :lang declaration, for example <span lang="en"> |
| div > p | child selector |