This page shows some examples about the selectors introduced with CSS3.
We can divide the CSS3 selectors in three categories:
A paragraph having class attributes
and containing some span
elements.
A span having attribute foo="a-test"
,
a span having attribute foo="another"
and
a span having attribute foo="a clean one"
.
A span having attribute foo="file.txt"
,
a span having attribute foo="filetxt"
, and
a span having attribute foo="file is txt"
.
A span having attribute foo="substring"
and
a span having attribute foo="sub strings"
.
A
span next (directly) to the paragraph having class
attributes
.
A
span preceded (not directly) by the paragraph having class
attributes
.
A
simple division containing some reference
anchor elements, and some
href
links pointing to these elements.
Click on the different
links to see how the CSS3 property change the
target anchor.
Try also to select some text: it should change color, depending by your browser (see CSS code).
A paragraph containing some text, a filled "abbr" tag and an empty one "".
A paragraph having id=unique
. Among the children of this paragraph,
only the content of the cite
element will be left unchanged (this one), i.e. will not change color.
Remark: in order to use the :root
selector, the CSS definition should be set within the
head
element, in order to be loaded before the page, since the :root
is usually the
html
element of the document.