|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
CSS: apply "hover" only individual elements
How can I apply the CSS "hover" element only to certain tags by using the "style" attribute?
__________________
- "Cryptographically secure linear feedback shift register based stream ciphers" -- a phrase that'll get any party started. - Why know the ordinary when you can understand the extraordinary? - Sponsor my caffeine addiction! (36.70 USD recieved so far -- Latest donor: Mark Foxvog) |
|
#2
|
||||
|
||||
|
If you ask such a question, it's because probably you're an i.e. user.
How to apply hover to individual elements? In theory, you do it like this: Code:
To apply hover to an element, example a div:
DIV {background-color: white}
DIV:hover {background-color: black}
To apply hover to a class, example a class "test" applied to a paragraph:
P.test {background-color: white}
P.test:hover {background-color: black}
In practice, this rule is valid for all browsers (so it works on all browsers) except i.e., which supports the :hover only if applied to element A. So what do we do with i.e.? It's tricky, but there is a way to overcome the problem. You use the "behaviour" feature, to which you apply a jscript to do the hover bit. For a wonderful explanation (& script), that will solve all your problems, see: http://www.xs4all.nl/~peterned/csshover.html & download the script. I suggest you take a look at the source code of the above page, to see exactly how the feature is implemented. Looks complicated but it's really easy. Ciao |
|
#3
|
||||
|
||||
|
Bah! One more reason to dump IE..... If it were't for the fact that Netscape has a really crappy HTML table interpretation and Opera's HTML tag interpretation in general wasn't designed by squirrels I would switch off, but I'm stuck with it...
![]() Thanx, I'll look at that...... ![]() |
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > CSS: apply "hover" only individual elements |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|