Declaration:
selector { property: value; }
Basic selectors:
#id
(id is set by «id» attribute).class
(class is set by «class» attribute)tag
(tags are <html>, <p> and things like that)- universal selector
*
Combinators:
<space>
— childs+
immediate sibling>
direct child~
any sibling that goes below
Pseudo-elements:
::before
::after
::first-letter
::first-line
::marker
::selection
Pseudo-classes:
:first-child
:last-child
:empty
:only-child
:nth-child(even/odd/n)
:nth-of-type()
:not()
:focus
:hover
:visited
— for links:checked
— for
Attribute selectors (attributes are: href
, src
and things like that):
[attr^="value"]
— match start[attr$="value"]
— match end[attr*="value"]
— match anywhere- also: add flags like «s» or «i» for case-sensitive and such