Class # Id : Element Element, Element Element Element Element
Class # Id : Element Element, Element Element Element Element
php/tag/css-selectors/
Selector
Example
Example Description
.class
.intro
#id
#firstname
element
element,element
div,p
element element
div p
element>element
div>p
element+element
div+p
[attribute]
[target]
[attribute=value]
[target=_blank]
[attribute~=value]
[title~=flower]
[attribute|=value]
[lang|=en]
:link
a:link
:visited
a:visited
:active
a:active
:hover
a:hover
:focus
input:focus
:first-letter
p:first-letter
:first-line
p:first-line
:first-child
p:first-child
:before
p:before
:after
p:after
:lang(language)
p:lang(it)
element1~element
2
p~ul
[attribute^=value]
a[src^="https"]
[attribute$=value]
a[src$=".pdf"]
[attribute*=value]
:first-of-type
p:first-of-type
:last-of-type
p:last-of-type
:only-of-type
p:only-of-type
:only-child
p:only-child
:nth-child(n)
p:nth-child(2)
:nth-last-child(n)
p:nth-last-child(2)
:nth-of-type(n)
p:nth-of-type(2)
:nth-last-of-type(n)
p:nth-last-oftype(2)
:last-child
p:last-child
:root
:root
:empty
p:empty
:target
#news:target
:enabled
input:enabled
:disabled
input:disabled
:checked
input:checked
:not(selector)
:not(p)
::selection
::selection