I'm trying to validate my CSS. I keep getting an error, caused by a downlevel-revealed conditional comment: <!--[if !IE]><!--> body { font-size: 16px; } <!--<![B][[/B]endif]--> Code (markup): The error says, "Unknown error java.lang.RuntimeException: Encountered "[" at line 19, column 7". It refers to the first "[" in the closing tag of the conditional comment. I've checked everywhere and learnt that this is the valid way of doing a downlevel-revealed conditional comment. Apparently, the method provided by Microsoft is invalid: <![if !IE]> <![endif]> Code (markup): If I am using the valid method, why is it still not validating? I've also tried the following, which doesn't validate, either. <!--[if !IE]>--> <!--<[endif]--> Code (markup): Any ideas?
I'm talking about down-level revealed conditional comments, not down-level hidden conditional comments. Here's an explanation of their differences: IE Conditional Comments
<!--[if !ie]>--> <p>ie doesn't see this.</p> <!--[endif]>--> <![if !ie]> <p>second thing that ie doesn't see</p> <![endif]> <!--[if !IE]><!--> <p>third thing.</p> <!--<![endif]--> Code (markup): All three work equally well. The second is not valid, but works because browsers are supposed to ignore unknown tags. IE reads it as ignore everything until the endif statement. CCs one and three validate. Personally, I'd go with the first version. cheers, gary
None of them validate for me. That's what I am trying to say. Here is the error that I'm getting now: "Encountered "[" at line 13, column 7. Was expecting: <EOF>" Line 13, column 7 is the opening square bracket ([) of the closing tag of the conditional comment. Why isn't it validating for me?
My CSS is external. I'm using the conditional comment in accordance with the method explained on this page, which concerns the best practice to follow when sizing text in CSS.
The CCs may not be used in the stylesheet. They belong in the html document. You are not using them in accordance to the article. cheers, gary
Uhm, conditional comments are HTML only. Once you open a <style> tag or in an external CSS, they're invalid since you are no longer writing HTML, you are writing CSS, and there are NO IE CC's for CSS, and frankly forget validation, that shouldn't even work in the browser... <!--[if !IE]><!--> <style type="text/css"> body { font-size: 16px; } </style> <!--<![endif]--> SHOULD validate... NOT that you should have to target IE for something like a font tag, or use CC's for CSS in the first place. 10 to 1 the problem you are trying to circumvent with that is not so much with IE as it is with your CSS and/or markup. If we could see the offending page or a demonstration of why you are trying to do that in the first place, we could probably be of more help - though you might not care for the answers.