@konithomimoFeb 22.2006 — #There are many ways. On way is to check what browser they are using, and then just take in the code for your page and replace the source value with the one for their browser.
@benycFeb 23.2006 — #Why use conditional comments?
IE 5 is the only browser you should need to use a seperate stylesheet for. And who cares about IE 5 users anymore. Anyway, if you do need to cater to them, use Tantek's mid pass filter:
@JPNKauthorFeb 23.2006 — #Well, I'm using an external style sheet, and when I viewed it in Firefox, it worked fine, but when I viewed it in IE, the text was huge.
@KravvitzFeb 23.2006 — #Using that, would the code be:
[CODE] <!--[if !IE]> <link type="text/css" rel="stylesheet" href="style.css"> <![endif]--> <!--[if IE]> <link type="text/css" rel="stylesheet" href="style2.css"> <![endif]-->[/CODE][/QUOTE] No. The stylesheet for other browsers can not be in the conditional comment because they think it is a normal HTML comment and ignore it.
Within the head tag?[/QUOTE] Yes.
Why use conditional comments?[/code]
Because it is a safe way to give rules to IE5+/Win. You can even specify which versions will use the rules. They have fixed several of the bugs that were in IE6 so several CSS hacks will not work in IE7.
IE 5 is the only browser you should need to use a seperate stylesheet for. And who cares about IE 5 users anymore.[/QUOTE] "should need"... well IE6 is still buggy and lacks support for much of CSS2.
There is still a significant number of IE5 users. Ignoring them is a bad idea in my book.
Anyway, if you do need to cater to them, use Tantek's mid pass filter:
@JPNKauthorFeb 23.2006 — #Kravitz: So what would I put there if firefox ignores them as comments? If I leave the Firefox tag out of the comments, and open it in IE, it'll have two <link> tags.
And really, what is the point of validation. There are plenty of reasons to write markup/css that doesn’t validate. I think it’s more important to understand the ramifications of the markup/css choices you make, and to have valid reasons for making those choices, than it is to write code that validates for the sake of validation.
But thats just me.
And, how is an IE conditional comment any less hack-y then a CSS hack.
@KravvitzFeb 23.2006 — #A lot of the CSS hacks are based on bugs or lack of support for something in one browser or another. Bugs can be fixed and support can be added.
I agree, validating for the sake of validation is silly.