/ Published in: JavaScript
There have been a few times where I've been forced to reduce myself to browser sniffing. In this example, I'm making an ad hoc change to CSS but for anyone interested in making changes to IE6/IE7 only, there's a better way. Take a look at my other snippet. http://snipplr.com/view/9095/html-conditional-html-for-ie6-and-ie7/
Expand |
Embed | Plain Text
//A. Target Safari if( $.browser.safari ) $("#menu li a").css("padding", "1em 1.2em" ); //B. Target anything above IE6 if ($.browser.msie && $.browser.version > 6 ) $("#menu li a").css("padding", "1em 1.8em" ); //C. Target IE6 and below if ($.browser.msie && $.browser.version <= 6 ) $("#menu li a").css("padding", "1em 1.8em" ); //D. Target Firefox 2 and above if ($.browser.mozilla && $.browser.version >= "1.8" ) $("#menu li a").css("padding", "1em 1.8em" );
Comments
Subscribe to comments
You need to login to post a comment.

Works great!
Works great!
umm this can be useful as an alternative to IE conditional comments. Fav! :)
@Snowalker, I agree completely. That's why I also suggest looking at my conditionals snippet. http://snipplr.com/view/9095/html-conditional-html-for-ie6-and-ie7/