CSS pseudo-elements are used to set special effects to certain selectors.
The use of pseudo-elements is similar to pseudo-classes:
{property:value;}
CSS classes can also be used in conjunction with pseudo-elements:
{property:value;}
: First-line Pseudo-element: sets a special style to the first line of text.
P:first-line { color:#ff0000; font-variant:small-caps; }
: First-letter Pseudo-element: sets a special style to the first letter of the text.
P:first-letter { color:#ff0000; font-size:xx-large; }
Css2-:before Pseudo-element: You can insert new content in front of the content of the element.
H1:before { content:url (logo.gif); }
Css2-:after Pseudo-element: You can insert new content after the element's contents.
H1:after { content:url (logo.gif); }
Pseudo-Elements and CSS classes:
P.article:first-letter { color: #FF0000; }
<class= "article">paragraph in an article. </ P >
Multiple pseudo-elements: can be combined with multiple pseudo-elements
P:first-letter { color:#ff0000; font-size:xx-large; } P:first-line { color:#0000ff; font-variant:small-caps; }
Six CSS Pseudo-elements