PDA

View Full Version : Need help - CSS parse error



iF15
11-16-2007, 07:32 AM
During my CSS validation in WC3 I got a very strange parse error in the body:

Parse Error -
body {
background: url(../images/body-bg.jpg) repeat-x top left;
padding-top: 40;
margin: 0 auto;
line-height: 1.5em;
}

This is the only error I received, however Dreamweaver didn't detect this error at all - everything renders perfect in all browsers, can anyone help?

tech_support
11-16-2007, 07:52 AM
body {
background: url(../images/body-bg.jpg) repeat-x top left;
padding-top: 40px;
margin: 0 auto;
line-height: 1.5em;
}

Twey
11-16-2007, 07:53 AM
padding-top: 40;You forgot to specify units. The only measurement that doesn't require units is 0, which is the same on any scale.
everything renders perfect in all browsersIf it renders perfectly on most browsers this means that your document is outdated or invalid in some way, thus triggering quirks mode in those browsers. Your DOCTYPE should be:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

jscheuer1
11-16-2007, 08:26 AM
Maybe it just means that the page looks OK with no added padding on the body element.

Twey
11-16-2007, 09:23 AM
Could be, could be. In this case you should remove the declaration entirely, or explicitly set it to 0.

iF15
11-16-2007, 12:08 PM
Sorry guys that was a typo I didn't put "px" on the first post I made. Strange how theres a error aye?

My doc type is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

iF15
11-16-2007, 12:30 PM
I had to add "@charset "utf-8";" at the top of my CSS file which got rid of the error. Is that normal?

Twey
11-16-2007, 01:12 PM
If you had a UTF-8 character (possibly whitespace) that can't be interpreted as whatever your webserver was serving it as (probably ISO-8859-1), then yes.

jscheuer1
11-16-2007, 11:23 PM
If you had a UTF-8 character (possibly whitespace) that can't be interpreted as whatever your webserver was serving it as (probably ISO-8859-1), then yes.

Good! Probably, even. We can't be 100% sure without seeing the live page though.