HTML and CSS Reference
In-Depth Information
Selector
Description
Example
Defined In
Selects all elements
of E that have the
attribute attr that ends
with the given value
CSS3
E[ attr $= value ]
p[title$="!"] {color: red;}
/* sets the color to red if the
title ends with an exclamation
mark */
E[ attr *= value ]
Selects all elements
of E that have the
attribute attr that
contains the given
value
p[title*="CSS"] {font-style:
italic;}
/* sets the font style to italic
in any p tag that has CSS in its
title */
CSS3
Specifies the unvisited
link
CSS1
a:link
a:link {font-weight: bold;}
/* makes unvisited links bold */
Specifies the link as it
is being pressed
CSS1
a:active
a:active {color: red;}
/* makes links red as they are
pressed */
a:visited
Specifies the link after
being pressed
a:visited {text-decoration: line-
through;}
/* puts a line through visited
links */
CSS1
:after
Sets a style to be used
immediately following
the element
div:after {content:
url(sectionend.gif);}
/* inserts the sectionend.gif
image immediately following all
div tags */
CSS2
::after
Same as :after ;
changed under CSS3
to make pseudo-
elements obvious
div::after {content:
url(sectionend.gif);}
/* inserts the sectionend.gif
image immediately following all
div tags */
CSS3
Sets a style to be used
immediately before the
element
CSS2
:before
div:before {content:
url(sectionstart.gif);}
/* inserts the sectionstart.gif
image before all div tags */
::before
Same as :before ;
changed under CSS3
to make pseudo-
elements obvious
div::before {content:
url(sectionstart.gif);}
/* inserts the sectionstart.gif
image before all div tags */
CSS3
:checked
Selects the elements
that are checked
:checked {color: blue;}
/* sets the color to blue if an
element is checked */
CSS3
T ABLE 5-5 CSS Selectors (continued)
 
Search WWH ::




Custom Search