Quote:
Originally Posted by PaulClark
Marcos (Marc?) - It's clear from your comment that you know how to make sites do what you want them to do. This solution:
works. But - what's so great about making your HTML more complex solely to avoid a standards-friendly, well supported use of conditional comments to target specific directives for browsers that have ideosynchratic rendering?
I agree with not having multiple stylesheets - hard to maintain, and extra round trips to the server to load up, but using conditional comments and dependent selectors it is very easy to target IE versions, as follows:
In the HTML page:
HTML Code:
<body>
<!--[if lte IE 6]>
<div id="isIE_version_LTE6">
<![endif]-->
<!--[if IE 7]>
<div id="isIE_version_7">
<![endif]-->
[PAGE CONTENT GOES HERE]
<!--[if lte IE 7]>
</div>
<![endif]-->
</body>
In the CSS file:
HTML Code:
.someclass {
[rules for someclass that IE renders incorrectly]
}
#isIE_version_7 .someclass {
[any additional rules required for IE7]
}
#isIE_version_LTE6 .someclass {
[any additional rules required for IE6]
}
This approach minimises the need to mess around with your HTML, as you suggest doing to get around peculiarities of IE6 box model rendering, it is standards-friendly, and it doesn't rely on any hacks (a hack, to my mind, being exploiting one bug to get around another).
|
Hi Paul,
I think we're going to have to agree to disagree on this one. Basically both methods achieve the same results. For me, conditional comments use more code overall than the way I would do it, I can get a bit anal about keeping my code as compact as possible. I've also always seen conditional comments as a hack, whether they are or not I really couldn't comment to be honest.