The code is the following: * html .postcol img {width:expression(this.width > 260? "260px" : this.width);} Code (markup): Can't seem to validate this piece of code!
There is no such thing as "expression". It's a Microsoft only thing you should never use because it will only work in IE.
Just use conditional iexplorer statements in your html. Of course that makes the validator look the other way. Otherwise don't use em
Wrong. You then contradict yourself - Correct. Bullshit. You use it BECAUSE it only works in IE, to make up for things that are MISSING from IE - in this case Max-width. That is the REALITY of writing cross browser code with a third of the users at large still using IE6. CSS validation in combination with working cross browser is usually going to fail. If you know WHY it is failing, as in 'expression' does not validate, then you can skip that line - if it's a problem on a project, document WHY it is used. This: * html .postcol img {width:expression(this.width > 260? "260px" : this.width);} Is the IE6/earlier version of THIS: .postcol img {max-width:260px;} Though I'd have written it: * html .postcol img { width:expression(this.width>260 ? "260px" : "auto"); } Just to avoid the extra variable reference... While I am a huge stickler for valid markup as there is NO excuse for invalid HTML/XHTML - Valid CSS on the other hand is a pipedream if you want certain things to work quickly and easily in legacy IE. You need min-width and max-width in IE, an expression is a hell of a lot simpler than a parsing script - and since both are going to tie you to javascript, use the one that's less code. I wouldn't sweat that line not validating... Just as I would not sweat using zoom:1; to trip haslayout, -moz-inline-block and -moz-inline-box making up for firefux still (even in 3, even when they allege that it works properly) being a ***tard about inline-block, the use of -moz-opacity and filter:alpha(opacity=xx) to make up for gecko and IE being ****tards about opacity, etc, etc... Any coder worth their salt should take one look at that and go "Oh, IE min-width. Yeah, that won't validate - don't worry about it. It's the price we pay to support the majority of users who don't even know what a browser is, and have no interest in learning. Duuuuh... I just click the big blue E!" When it comes to CSS if you know WHY it doesn't validate (like say... and IE only property) then don't worry about it... Just be sure the stuff that SHOULD validate does so.