Forum Moderators: not2easy
I have a stylesheet which contains IE proprietary styles and call it in the template by use of:
<!--[if lte IE 6]><link rel="stylesheet" type="text/css" media="all" href="ie.css" /><![endif]--> and for IE7
<!--[if IE 7]><link rel="stylesheet" type="text/css" media="all" href="ie7.css" /><![endif]--> ie.css contains MS filters which W3C is complaining about (filter: progid:DXImageTransform.Microsoft.AlphaImageLoader)
From W3C:
attempt to find a semi-colon before the property name. add it
Property progid doesn't exist : DXImageTransform
Parse Error - DXImageTransform.Microsoft.AlphaImageLoader(src='blah.png');
Parse Error
I can see why it is complaining about the double use of a colon. Is there a way to get this to validate?
the answer is actually in the title..
IE proprietary styles do not validate W3C compliant
Microsoft proprietary code is just that, proprietary. It is not in the W3C recommendations, so it won't validate to their requirements.
It is widely accepted by anyone who works with CSS & validation, that code within a Conditional Comment (also MS propietary) is not always going to be valid and no-one expects it should be IMHO. Their purpose enables us to take hacks and workarounds out of the main stylesheet to enable it [main stylesheet] to validate going forward..
I don't think anyone who understands what CC's and IE code is all about would ever validate them, so as Robin says, if you're using MS code for a reason as long as it works and is hidden in a CC don't worry about the warnings.
There is a major difference between "Property doesn't exists" and "Parse error" since a parse error is much more likely to throw some browsers off - Safari, for instance.
When encountering an unrecognized property, most browsers just skip them and go on with the ones it recognizes.
However, when stumbling upon a parse error, it might discard the rest of the stylesheet completely, or even the whole stylesheet.
Example:
When validating, the IE proprietary property
filter: alpha(opacity=50);
usually throws both the "property doesn't exists" and "parse error" because of the "=" character.
Is there a way to write this so that it won't throw a parse error and IE will still process it?
If you don't want errors then the best thing to do is move your IE-only workarounds into a separate stylesheet, don't bother trying to validate it and serve it to IE using a conditional comment.