homepage Welcome to WebmasterWorld Guest from 54.196.197.153
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderator: open

CSS Forum

    
Using "Bare Pseudo Classes"?
Beware you should test in NN7..
SuzyUK




msg:1205180
 10:14 am on Mar 8, 2003 (gmt 0)

Hi a few weeks ago someone here replied to a post (sorry I can't remeber which one) and said that I could shorten my code because I didn't have to have the anchor link before it's state..i.e.

instead of:
a:link, a:visited, a:hover, a:active
Use
:link :visited :hover :active

However I would just like to make a reference to "arbitrary-hover" [devedge.netscape.com] and from it this quote especially:

In browsers based on Netscape Gecko builds later than 20020410 (Netscape 6.1+), :hover styles can be applied to any element in a document. Thus authors who have used bare pseudo-classes, or bare class-pseudo-class combinations, are at risk for seeing hover styles applied to more than just their links. The most reliable fix is to add the anchor element to the selectors, like this:

a:hover {color: red;}
a.nav:hover {color: red;}

Basically using the "bare pseudo class" could cause every element on the page to change it's state on hover, admittedly the article goes on to futher explain that it may not happen in quirks mode, but the possibility is always there.

My advice always add the element to the selector ;) Anyhow for me that makes the code easier to read later

Suzy

 

DrDoc




msg:1205181
 10:22 am on Mar 8, 2003 (gmt 0)

Thanks for your advice, Suzy. And I agree wholeheartedly. Besides, that leaves some room for future CSS standards (and browsers) as well. No need to go back and change your "old" CSS if you use the full a:pseudo selector :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved