CSS Selector
Table of contents
Selectors
Selector | Example |
---|---|
element | p |
.class | |
#id | |
[attribute=”value”] | [img src=”url”] |
element:nth-child(n) | p:nth-child(2) → 2nd <p> of its parent |
* (all) |
Operators
Operator | Example | Description |
---|---|---|
OR | element,element | ,(comma) |
AND | .class1.class2 | (no whitespace) |
descendant | element element | (whitespace) |
child | element>element | > |