HTML and CSS Reference
In-Depth Information
To apply the hover pseudo-class:
1. Return to the sa_styles.css file in your text editor.
2. Add the following style rule, as shown in Figure 3-52:
nav ul li:hover {
background-color: rgb(83, 142, 213);
}
Figure 3-52
Applying the hover pseudo-class
change the background color to
medium blue when the use r hovers
the mouse pointer over the list items
3. Save your changes to the file and then reload home.htm in your Web browser.
Move your mouse pointer over the navigation list items. As shown in Figure 3-53,
the background color of the navigation list items changes to medium blue in
response to the hover event.
Figure 3-53
Viewing the rollover effect
rollover effect
Deprecated Attributes for Hypertext Links
Earlier versions of HTML did not support CSS and the link , visited , hover , and
active pseudo-classes. If a Web page author wanted to change the color of a hypertext
link, he or she would have to add the attributes
<body link=” color ” vlink=” color ” alink=” color ”>
to the <body> tag, where the link attribute specifies the color of unvisited links, the
vlink attribute specifies the color of visited links, and the alink attribute specifies the
color of active links. Colors had to be entered either as a supported color name or as a
hexadecimal color value. The link , vlink , and alink attributes have been deprecated
and their use is discouraged, but you still might see them in the code of older Web pages.
Search WWH ::




Custom Search