<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to Use Conditional Comments for Better CSS</title>
	<atom:link href="http://www.sitepoint.com/blogs/2008/11/13/how-to-use-conditional-comments-for-better-css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sitepoint.com/blogs/2008/11/13/how-to-use-conditional-comments-for-better-css/</link>
	<description>News, opinion, and fresh thinking for web developers and designers. The official podcast of sitepoint.com.</description>
	<lastBuildDate>Mon, 23 Nov 2009 10:06:45 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Arkh</title>
		<link>http://www.sitepoint.com/blogs/2008/11/13/how-to-use-conditional-comments-for-better-css/comment-page-1/#comment-834885</link>
		<dc:creator>Arkh</dc:creator>
		<pubDate>Tue, 18 Nov 2008 09:48:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=3155#comment-834885</guid>
		<description>I discovered this technique in a post on stackoverflow : I love it and started using it. One valid CSS file at the cost of some markup to add in the header and the footer is awesome.</description>
		<content:encoded><![CDATA[<p>I discovered this technique in a post on stackoverflow : I love it and started using it. One valid CSS file at the cost of some markup to add in the header and the footer is awesome.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Serge Krul</title>
		<link>http://www.sitepoint.com/blogs/2008/11/13/how-to-use-conditional-comments-for-better-css/comment-page-1/#comment-834390</link>
		<dc:creator>Serge Krul</dc:creator>
		<pubDate>Mon, 17 Nov 2008 22:41:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=3155#comment-834390</guid>
		<description>@tactics

Your answer signifies that you did come across ie&#039;s shortcomings in your development. I also understand from your answer that you used some hacks in your main css file to work around them. 
In this case it&#039;s just a matter of personal preference, not bad/good practice: you prefer to let every browser download all the css, regardless of it&#039;s validity or necessity, and i prefer to use conditional comments to serve the &quot;ugly&quot; stuff only to those who need it. 
However, and this is my point, in some medium-scale projects it can become complex to maintain the conditional files. Therefore the little trick presented here is really nice for such cases, as I mentioned earlier.
As to your last point, you completely misunderstood me. I never ever wanted to imply that js sniffing is reliable. On the contrary, what i said was that if you use this technique you don&#039;t need to use js sniffing because the so-called sniffing is done at html level by the conditional comments. You&#039;re just checking if the className property of the body element contains  the string &quot;ie&quot;.
For some reason you also decided that i rely on js for presentation while i only mentioned using it for &lt;a href=&quot;http://htmldog.com/articles/suckerfish/dropdowns/&quot; rel=&quot;nofollow&quot;&gt;suckerfish menus&lt;/a&gt;. I&#039;m always cautious about jumping to conclusions about other people&#039;s code.</description>
		<content:encoded><![CDATA[<p>@tactics</p>
<p>Your answer signifies that you did come across ie&#8217;s shortcomings in your development. I also understand from your answer that you used some hacks in your main css file to work around them.<br />
In this case it&#8217;s just a matter of personal preference, not bad/good practice: you prefer to let every browser download all the css, regardless of it&#8217;s validity or necessity, and i prefer to use conditional comments to serve the &#8220;ugly&#8221; stuff only to those who need it.<br />
However, and this is my point, in some medium-scale projects it can become complex to maintain the conditional files. Therefore the little trick presented here is really nice for such cases, as I mentioned earlier.<br />
As to your last point, you completely misunderstood me. I never ever wanted to imply that js sniffing is reliable. On the contrary, what i said was that if you use this technique you don&#8217;t need to use js sniffing because the so-called sniffing is done at html level by the conditional comments. You&#8217;re just checking if the className property of the body element contains  the string &#8220;ie&#8221;.<br />
For some reason you also decided that i rely on js for presentation while i only mentioned using it for <a href="http://htmldog.com/articles/suckerfish/dropdowns/" rel="nofollow">suckerfish menus</a>. I&#8217;m always cautious about jumping to conclusions about other people&#8217;s code.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: tactics</title>
		<link>http://www.sitepoint.com/blogs/2008/11/13/how-to-use-conditional-comments-for-better-css/comment-page-1/#comment-834219</link>
		<dc:creator>tactics</dc:creator>
		<pubDate>Mon, 17 Nov 2008 20:47:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=3155#comment-834219</guid>
		<description>Hi Serge. In answer to your questions:

1. I don&#039;t use the IE png fix. I rarely use transparent png&#039;s because their file size is larger than gifs. If it is necessary for a particular project, I use a gif for IE, and a png for &quot;real&quot; browsers using the !important declaration in my stylesheet. If you view any of the lightbox popups on classmates.com, you will see an example of where I did that. It just looks a little less fancy on IE6 than it does on other browsers.

2. The no max-width/max-height thing can be addressed using the &quot;width: expression&quot; hack: http://www.cameronmoll.com/archives/000892.html 
It&#039;s not very elegant, but it works. None of the other issues you mention have ever been a problem for me. 

3. Browser sniffing with js is NOT more reliable. 10% of people have js disabled. And relying on js for your presentation is contrary to the whole concept of separating your functionality from your content and presentation: http://www.sitepoint.com/article/simply-javascript/</description>
		<content:encoded><![CDATA[<p>Hi Serge. In answer to your questions:</p>
<p>1. I don&#8217;t use the IE png fix. I rarely use transparent png&#8217;s because their file size is larger than gifs. If it is necessary for a particular project, I use a gif for IE, and a png for &#8220;real&#8221; browsers using the !important declaration in my stylesheet. If you view any of the lightbox popups on classmates.com, you will see an example of where I did that. It just looks a little less fancy on IE6 than it does on other browsers.</p>
<p>2. The no max-width/max-height thing can be addressed using the &#8220;width: expression&#8221; hack: <a href="http://www.cameronmoll.com/archives/000892.html" rel="nofollow">http://www.cameronmoll.com/archives/000892.html</a><br />
It&#8217;s not very elegant, but it works. None of the other issues you mention have ever been a problem for me. </p>
<p>3. Browser sniffing with js is NOT more reliable. 10% of people have js disabled. And relying on js for your presentation is contrary to the whole concept of separating your functionality from your content and presentation: <a href="http://www.sitepoint.com/article/simply-javascript/" rel="nofollow">http://www.sitepoint.com/article/simply-javascript/</a></p>]]></content:encoded>
	</item>
	<item>
		<title>By: Serge Krul</title>
		<link>http://www.sitepoint.com/blogs/2008/11/13/how-to-use-conditional-comments-for-better-css/comment-page-1/#comment-833165</link>
		<dc:creator>Serge Krul</dc:creator>
		<pubDate>Mon, 17 Nov 2008 08:33:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=3155#comment-833165</guid>
		<description>Maybe for a simple web site you can do with one conditional stylesheet, but when you design something bigger you end up with at least four files: (ie6,ie7) x (css,js). The maintenance of such a mess is horrible. The files sometimes reside at different places, and when you edit your main css/js file you can never know what ie mess is hiding somewhere. You need to leave comments in your main css/js. And when something in those conditional files is altered you need to update those comments. A nightmare. This technique saves you a big mess cause you can put all your stuff in one file. Yes, the good browsers will have to download more code. But the extra code is a lot smaller in proportion to the extra maintenance work you need to do.
I would also like to ask the people above me who do not use any hacks how do they deal with no png, no hover, no max-width in ie6, hasLayout bugs (specifically a.p offsets mess and jumps on hover), 1px round bug, ie&#039;s own z-index model and other &lt;a href=&quot;http://www.brunildo.org/test/&quot; rel=&quot;nofollow&quot;&gt;peculiarities&lt;/a&gt;.
As for browser sniffing in js, this method is much more reliable than anything else because actually the sniffing is done at the html level by the conditional comments, you only need to check the className of body and execute any needed ie code (like suckerfish menus for example).</description>
		<content:encoded><![CDATA[<p>Maybe for a simple web site you can do with one conditional stylesheet, but when you design something bigger you end up with at least four files: (ie6,ie7) x (css,js). The maintenance of such a mess is horrible. The files sometimes reside at different places, and when you edit your main css/js file you can never know what ie mess is hiding somewhere. You need to leave comments in your main css/js. And when something in those conditional files is altered you need to update those comments. A nightmare. This technique saves you a big mess cause you can put all your stuff in one file. Yes, the good browsers will have to download more code. But the extra code is a lot smaller in proportion to the extra maintenance work you need to do.<br />
I would also like to ask the people above me who do not use any hacks how do they deal with no png, no hover, no max-width in ie6, hasLayout bugs (specifically a.p offsets mess and jumps on hover), 1px round bug, ie&#8217;s own z-index model and other <a href="http://www.brunildo.org/test/" rel="nofollow">peculiarities</a>.<br />
As for browser sniffing in js, this method is much more reliable than anything else because actually the sniffing is done at the html level by the conditional comments, you only need to check the className of body and execute any needed ie code (like suckerfish menus for example).</p>]]></content:encoded>
	</item>
	<item>
		<title>By: tactics</title>
		<link>http://www.sitepoint.com/blogs/2008/11/13/how-to-use-conditional-comments-for-better-css/comment-page-1/#comment-826248</link>
		<dc:creator>tactics</dc:creator>
		<pubDate>Fri, 14 Nov 2008 09:11:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=3155#comment-826248</guid>
		<description>I&#039;ve never had to use conditional CSS to get IE7 to behave. In cases where I need to do something different for IE6, I just use the &quot;!important&quot; statement in my external CSS file and that does the trick. I&#039;ll agree with others here that the method suggested here is a bad practice.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve never had to use conditional CSS to get IE7 to behave. In cases where I need to do something different for IE6, I just use the &#8220;!important&#8221; statement in my external CSS file and that does the trick. I&#8217;ll agree with others here that the method suggested here is a bad practice.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: dmwalk</title>
		<link>http://www.sitepoint.com/blogs/2008/11/13/how-to-use-conditional-comments-for-better-css/comment-page-1/#comment-825914</link>
		<dc:creator>dmwalk</dc:creator>
		<pubDate>Thu, 13 Nov 2008 20:19:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=3155#comment-825914</guid>
		<description>I see no reason to use this over a simple ie (or ie6, etc.) style sheet with conditional comments in the head. Not only do you have to repeat the conditional markup multiple times in your html, you then have to generate new classes in your css which get mixed in with your non-ie classes. When ie6 goes away, hopefully in another year, you have a mess to clean up in both your html markup and your css stylesheet. I don&#039;t see this making any sense to use.</description>
		<content:encoded><![CDATA[<p>I see no reason to use this over a simple ie (or ie6, etc.) style sheet with conditional comments in the head. Not only do you have to repeat the conditional markup multiple times in your html, you then have to generate new classes in your css which get mixed in with your non-ie classes. When ie6 goes away, hopefully in another year, you have a mess to clean up in both your html markup and your css stylesheet. I don&#8217;t see this making any sense to use.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Stormrider</title>
		<link>http://www.sitepoint.com/blogs/2008/11/13/how-to-use-conditional-comments-for-better-css/comment-page-1/#comment-825638</link>
		<dc:creator>Stormrider</dc:creator>
		<pubDate>Thu, 13 Nov 2008 09:13:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=3155#comment-825638</guid>
		<description>I don&#039;t like conditional comments at all... I like my HTML to be pristine and leave all the messiness to the CSS! After all, the HTML document is the one containing important semantics, which will be used by far more user agents (screen readers for example) than the CSS.

I prefer to keep dirty hacks out the HTML.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t like conditional comments at all&#8230; I like my HTML to be pristine and leave all the messiness to the CSS! After all, the HTML document is the one containing important semantics, which will be used by far more user agents (screen readers for example) than the CSS.</p>
<p>I prefer to keep dirty hacks out the HTML.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Tyssen</title>
		<link>http://www.sitepoint.com/blogs/2008/11/13/how-to-use-conditional-comments-for-better-css/comment-page-1/#comment-825492</link>
		<dc:creator>Tyssen</dc:creator>
		<pubDate>Thu, 13 Nov 2008 03:10:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=3155#comment-825492</guid>
		<description>I wouldn&#039;t go down the route of creating conditional markup for different versions of IE in the HTML, but I did try out this technique just this week as I only came across it the other day too (must&#039;ve seen it in the same place you did ;).</description>
		<content:encoded><![CDATA[<p>I wouldn&#8217;t go down the route of creating conditional markup for different versions of IE in the HTML, but I did try out this technique just this week as I only came across it the other day too (must&#8217;ve seen it in the same place you did ;).</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Meitar</title>
		<link>http://www.sitepoint.com/blogs/2008/11/13/how-to-use-conditional-comments-for-better-css/comment-page-1/#comment-825445</link>
		<dc:creator>Meitar</dc:creator>
		<pubDate>Thu, 13 Nov 2008 01:17:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=3155#comment-825445</guid>
		<description>It&#039;s certainly possible that this is too little too late with regards to dealing with IE bugs, though if I&#039;d learned this technique as a CSS newbie rather than the multitude of various (and insanely complex) CSS hacks I&#039;ve used for years, this may have been the method I stuck with in those situations where an IE-only hack was simply necessary. I find it simpler in general and simplicity is generally what I&#039;m after.</description>
		<content:encoded><![CDATA[<p>It&#8217;s certainly possible that this is too little too late with regards to dealing with IE bugs, though if I&#8217;d learned this technique as a CSS newbie rather than the multitude of various (and insanely complex) CSS hacks I&#8217;ve used for years, this may have been the method I stuck with in those situations where an IE-only hack was simply necessary. I find it simpler in general and simplicity is generally what I&#8217;m after.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.sitepoint.com/blogs/2008/11/13/how-to-use-conditional-comments-for-better-css/comment-page-1/#comment-825404</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Thu, 13 Nov 2008 00:03:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=3155#comment-825404</guid>
		<description>Otherwise you have nothing better ?</description>
		<content:encoded><![CDATA[<p>Otherwise you have nothing better ?</p>]]></content:encoded>
	</item>
</channel>
</rss>
