Log in

View Full Version : expression in css



oye
12-17-2009, 09:33 AM
I am using expression in css for my light box it is working fine in all browsers but i was unable to get HTML validate it .....

Is there any solutions to get website HTML validate or is there any solution for expression

Wether we can use expression in css or not :(

jscheuer1
12-17-2009, 12:36 PM
CSS expressions are IE proprietary and do not work (are ignored by) other browsers. They will never validate. You may put them in a separate stylesheet and use IE conditional comments to make that stylesheet (if on the page) or stylesheet link (if an external stylesheet) look like a comment to all but IE. They still won't be valid, but the validator will also think they are comments, so won't bother you about them, ex:


<!--[if IE]>
<link rel="stylesheet" href="ieOnly.css" type="text/css">
<![endif]-->

See also:

http://msdn.microsoft.com/en-us/library/ms537512(VS.85).aspx

for more on how these comments work.