HTML and CSS Reference
Pseudoclasses, which use colons to separate an element from its state, are more sophisticated selectors. They are
frequently used to determine the style of hyperlinks, depending on their states. For example, Listing 5-33 applies to all
a elements but only when the mouse hovers over the link.
Listing 5-33. Link Color to Be Applied in Case an Anchor Is Being Hovered Over
Another example is Listing 5-34, which changes the color of all hyperlinks that have already been visited 5 to green.
Listing 5-34. Link Color Set to Visited Hyperlinks
Pseudoelements can be used to add style to specific element parts instead of whole elements. They can also be applied
for inserting content before or after certain elements. The combinator is a colon ( : ). For example, the CSS rule in
Listing 5-35 changes the font size of the first letter of all paragraphs within the web page to 2 em.
Listing 5-35. A Rule for the First Letter of Paragraphs
Property Value Types
CSS property values can be the following:
Keywords (for example,
Basic data types (for example,
Combination of keyword and custom data (for example,
Certain CSS properties can be grouped into a single property declaration. The most common shorthand notations are
described in the following sections.
5 According to the current browser history.