Selectors
Type selector |
Selects all elements with specified type |
A |
ID selector |
Selects an element with specific id |
#id |
Descendant selector |
Selects an element inside another |
div a |
Class selector |
Selects an element with a specific class name |
.class |
Universal selector |
Selects all elements |
* |
Adjacent sibling selector |
Selects elements that directly follows another element |
a + div |
General sibling selector |
Select all siblings in another element |
A ~ B |
Child selector |
Select direct child of an element |
A > B |
First child |
Selects first child of an element |
A:first:child |
Only child pseudo selector |
Selects an element that is the only element inside another |
:only-child |
Attribute selector |
Selects an element with an specific attribute |
[for] |