HTML and CSS Reference
In-Depth Information
Selector
Description
Example
Defined In
:first-line
Selects the first line of
an element
p:first-line {color: red;}
/* makes the first lines of
paragraph red */
CSS1
Same as :first-line ;
changed under CSS3 to
make pseudo-elements
obvious
CSS3
::first-line
p::first-line {color: red;}
/* makes the first lines of
paragraph red */
:first-letter
Selects the first letter of
an element
p:first-letter {font-size:
larger;}
/* makes the first letter of
a paragraph larger */
CSS1
::first-letter
Same as :first-
letter ; changed under
CSS3 to make pseudo-
elements obvious
p::first-letter {font-size:
larger;}
/* makes the first letter of
a paragraph larger */
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
: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
Same as :after ;
changed under CSS3 to
make pseudo-elements
obvious
CSS3
::after
div::after {content:
url(sectionend.gif);}
/* inserts the sectionend
.gif image immediately
following all div tags */
::selection
Selects the part of the
element that is currently
selected; supported
in Firefox as ::-moz-
selection as well
#test::selection {color:
red;}
/* makes the text red when
selected */
CSS3
T ABLE 4-8 CSS Pseudo-Element Selectors
 
Search WWH ::




Custom Search