I decided to show a message about why Internet Explorer is shite, and a link to get Firefox on the main page, but obviously only wanted to show it to IE users.
Initially, I had a div named #firefox, and defined it in the css as display:none, then overrode that definition with the * html hack that only IE understands. Therefore, non-IE browsers wouldn’t display it, and IE would accept the over-ride, and display the browser upgrade message:
#firefox{display: none;} /*don't show the Firefox ad in good browsers */
* html #firefox {display:block;} /*show Firefox ad to IE */
Thinking about it, though, I realised that I was switching content on and off rather than styles, so should be using the xhtml rather than the css for that, cause xhtml is about content and CSS is for style.
So, I changed the CSS so that #firefox was displayed to all browsers, and surrounded the html code with an IE-only conditional
comment:
<!--[if IE ]>
<div id=”firefox”>
blah blah blah
</div>
<[endif]—>
The html content is only parsed by IE (and thus takes the default style in the CSS). Non-IE browsers never use that CSS, as they never see the #firefox markup.
Now, the content is controlled by the markup, rather than the CSS. Anally retentive, moi?