Log in

View Full Version : 1 Validation error - <!--[if IE]> ie fix?



sjewson
01-30-2009, 08:07 AM
Hi Guys

This ones driving me crazy. I have 1 validation error listed below

Lexical error at line 237, column 3. Encountered: "[" (91), after : "<!"

My CSS is below, id there a possible fix to overcome this?

CSS
===
234 <!--[if IE]>
235 .#sidebar1 {padding-top: 30px;}
236 .#mainContent {zoom: 1; padding-top: 15px;}
237 <![endif]-->

Snookerman
01-30-2009, 08:18 AM
You can't have conditional comments in your css code. What you can do is put that code on your html page like this:

<!--[if IE]>
<style type="text/css">
#sidebar1 {padding-top: 30px;}
#mainContent {zoom: 1; padding-top: 15px;}
</style>
<![endif]-->


Good luck!

sjewson
01-30-2009, 09:00 AM
You can't have conditional comments in your css code. What you can do is put that code on your html page like this:

<!--[if IE]>
<style type="text/css">
#sidebar1 {padding-top: 30px;}
#mainContent {zoom: 1; padding-top: 15px;}
</style>
<![endif]-->


Good luck!

Thanks for your advice Snookerman. I removed the conditional statement from the CSS and placed it the HTML template page header. Good News is the CSS validates with the code removed from the external stylesheet, but the bad news is that the ie bug fix is not applied to my page when i place it in the <head>. Not sure where I should put the statement?

Snookerman
01-30-2009, 09:14 AM
Could it be because I removed the periods (.#sidebar1 {padding-top: 30px;})? I thought it was part of the line numbers so I removed them.

sjewson
01-30-2009, 09:21 AM
Ive got the bug fix to work in the main body of the page, but if you could take a quick look at the following page www.cdsrentals.com you can see there is a block of space indented to the top of the left hand side menu when viewed in IE6.

If i remove the conditional statement from the html page the space disappears!

I cant work this one out.

I appreciate all your help on this Snookerman, its really driving me crazy after two whole days now