Don Martiwww → Firefox banner

Contact

(Updated to include link to "hacking" article and MSDN page. Original posting date: 17 April 2005)

Dave Shea points out in an article that there's an easier way to do this kind of thing.

How do you put a big Firefox banner on your site for users of a certain broken proprietary browser—without annoying people who already have Mozilla, Firefox, Konqueror, or some other standards-compliant browser? Take advantage of a bug in MSIE's CSS support. Put this in the stylesheet:

body > div.hide {
   display: none;
}

then put the banner and any other browser-related message in a div with class="hide" that's not inside any other element. As long as MSIE doesn't support > you can have all kinds of fun with this.