In an earlier post I described how to use conditional comment codes to call a different stylesheet for each browser like so:
<link href=”style.css” rel=”stylesheet” type=”text/css” />
<link href=”not-ie.css” rel=”stylesheet” type=”text/css” />
At the end of the post I mentioned that you can use these comments to hide other content from each browser. I received some questions on this so I thought I better explain further.
To hide content from IE or a certain version of Internet Explorer is simple just use the appropriate comment codes anywhere on the page with the content between them like so:
The above examples will hide the content from IE or the IE version you specified in teh codes – HOWEVER it will only work that way in IE, because conditional comment codes are not read by Firefox.
So to hide content from Firefox you need to use your Firefox only stylesheet you declared in the header of your file. Whatever it is you want to hide in Firefox just wrap in a <div> with a class or id that in your Firefox stylesheet you add the css property of display: none.
So here is an example:
CONTENT TO HIDE FROM FIREFOX
Then in your Firefox only stylesheet you declare: