Skip to content

Latest commit

 

History

History
26 lines (23 loc) · 660 Bytes

css-selectors.md

File metadata and controls

26 lines (23 loc) · 660 Bytes

CSS Selectors

Here are the most useful CSS selectors:

Code Description
[attr="value"] = exact
[class~="box"] ~= has word
[href$=".doc"] $= ends in
[class*="-is-"] *= contains
h3 + p + adjacent sibling
article ~ footer ~ far sibling
.container > .box > direct child
:target (h2#foo:target)
:disabled
:nth-child
:nth-child(3n)
:nth-child(3n+2)
:nth-child(-n+4)
:nth-last-child(...)
:first-of-type
:last-of-type
:nth-of-type
:only-of-type only child of its parent thats like that
:only-child