The selector ":name" is a pseudo-class, used to give style to elements based on information known only to the browser (ex: visited links).
You can cause a style to become active when the cursor is hovered over an element. A common use for this is to cause a link to change appearances.
A:link { color: green; }
A:visited { text-decoration: overline; }
A:hover { background: rgb(235,235,235); cursor: crosshair; }
H2:hover { color: rgb(235,0,0); }
A:linkA:visitedA:hoverYou MUST define these pseudo classes in this order!
Note: A:hover applies to both <a
href="blah"
and <a name="blah"! (IE
does not do this, though it should, and may in the future)
The most widely supported method for setting hover
characteristics for A HREF
but not A NAME
, would be
to combine pseudo classes:
A:link:hover, A:visited:hover { color: white; background: black; }
Yet another would be to use an attribute selector (currently only supported in Netscape 7):
A[href]:hover { color: white; background: black; }
steer you clear of most of the problems caused by differerences between different brands and versions of browsers.
It is even possible to use Style Sheets to create a graphic and table-free navigation bar.
slide 25
|
"Mastering a Web Site" online course Created and maintained by Lorna Schmid and David Boldt. http://water.usgs.gov/usgs/training/webmaster/css_pseudo-classes.html Last modified: Mon Jan 24 12:41:13 EST 2005 |