Forum Moderators: not2easy

Message Too Old, No Replies

IE proprietary styles do not validate W3C compliant

         

SilverLining

11:39 am on May 30, 2007 (gmt 0)

10+ Year Member



Hi Everyone!

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?

Robin_reala

11:48 am on May 30, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The way to get the CSS to validate is to remove the invalid stuff! You're obviously using non-standard stuff for a reason so I wouldn't sweat it, you've specifically made your choice to be invalid so that's that.

[edited by: Robin_reala at 11:48 am (utc) on May 30, 2007]

simonuk

12:09 pm on May 30, 2007 (gmt 0)

10+ Year Member



Harsh reply :-/

Robin_reala

12:18 pm on May 30, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, it wasn't intended to be. Just today I've been adding PNG filters to the stylesheet I'm working on. I know though that there's no point in trying to push it through the validator when I've purposefully added invalid code - if you can get it past then surely that'd be a bug in the validator?

SuzyUK

12:20 pm on May 30, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



not harsh, unfortunately true..

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.

SilverLining

4:29 pm on May 30, 2007 (gmt 0)

10+ Year Member



Great, thank you for your responses.

trafficms

10:22 am on Jun 3, 2007 (gmt 0)

10+ Year Member



I use the W3C CSS Validator - not so much to make the validator happy - but more for the purpose of finding indicators of how to make the page show the desired result in as wide a range of browsers as possible.

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?

Robin_reala

1:46 pm on Jun 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, see my first answer in this thread. By adding that code you're causing an legitimate (at least, as far as I can see?) parsing problem with the stylesheet. If the validator didn't pick up on it then it wouldn't be doing its job.

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.