Prev | Current Page 72 | Next

Charles Wyke-Smith

"Stylin' with CSS: A Designer's Guide 2nd Edition"

If you just want
to de?¬? ne a link and a hover state, that??™s ?¬? ne. Sometimes it doesn??™t
make sense to have links show as having been visited.
A browser may skip some of these rules if you don??™t state them in
the order shown above: link, visited, hover, active. The mnemonic
???LoVe-HA!??? is an easy, if cynical, way to remember this.
You can use any element with these pseudo-classes, not just a, to
create all kinds of rollover effects. For example
p:hover {background-color:gray;}
This code will, well, I don??™t think I even need to tell someone as
smart as you what is apt to happen to your paragraph when you roll
over it.
Link (a) pseudo-classes are supported by all browsers tested for
this book??”IE5 and later. As mentioned before, be aware that IE6
does not support hovers on anything except links without a special
JavaScript ?¬? le called hover.htc being linked as an Internet Explorer
behavior to the page. IE7 does support hover on any element, but
only in pages with the Strict DOCTYPE. All a bit confusing, but we
will see how to make hover work on any element in any of our tested
browsers in a later chapter.
HOW CSS WORKS 51
Other Useful Pseudo-Classes
The purpose of pseudo-classes is to simulate classes being added
to your markup when certain conditions occur. Not only can they
be used to provide a response to user actions such as pointing and
clicking, but they can also be applied based on certain conditions
being true in your markup.


Pages:
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84