HTML and CSS Reference
In-Depth Information
Selecting elements involved in user interaction
In addition to :link and :visited , the selectors :hover and :active ( Table 6-7 )
are commonly associated with links. However, they can be used to respond to user in-
teraction on any element.
For example, the following is a short unordered list:
<ul>
<li>Milk</li>
<li>Eggs</li>
<li>Carrots</li>
<li>Butter</li>
<li>Almonds</li>
<li>Flour</li>
</ul>
To help the user visually pick out which item they are hovering over, the :hover
selector could be used to set up a style rule that changed the background color to light
gray:
li:hover { background-color:#ccc; }
This will be applied only when the user hovers over the items in the list, darkening
those rows the user is hovering over ( Figure 6-4 ).
 
Search WWH ::




Custom Search