Web Hosting Talk







View Full Version : Any way to ignore a page's CSS style?


Muze
11-02-2004, 10:43 PM
If you go here with IE
http://www.alternatemode.com/

You'll notice that rolling over the images of the instruments at the top will produce the same CSS hover effect that's found on all the text. These are transparent images. I already tried applying a class to the table that contains the images which uses a white colored hover so that it blends in better with the mostly white page background. Not only does it not work in all browsers, but it's a compromise I'd like to avoid. Any suggestions?

the_pm
11-02-2004, 10:54 PM
When you apply a class to that table, use a descendent selector to stop the style from applying to those elements:

#foo a:hover {background:none}

That'll stop that purple background color from appearing behind those images (assuming the id of the container around those links is foo - you can change it to be whatever you want).

Muze
11-08-2004, 05:44 PM
Thanks, worked like a charm. I applied the ID to the table holding my rollovers.

Currently I always apply custom selectors to the class, not the ID. Is ID better?

the_pm
11-08-2004, 05:48 PM
ID carries a higher order of specificity. In other words it carries more weight during the "cascade" than classes. But 99/100 this won't matter. IDs can only be used once per document, so if you're identifying more than one area with an ID, you'll need to change this to a class. In terms of how it functions, there's no significant difference between the two.