W3C Local CSS Validator Errors

The Situation
I am working on an update for our company website. I am developing it using an Apache server on my PC. It’s getting to the final stages of development so I thought I’d run the CSS through the W3C CSS Validator by using the “Validate Local CSS” option in the Firefox Web Developer Toolbar. I’ve only ever used the Local HTML validator before, I think the Local CSS validator might be a new addition (?).

The Problem
When I submitted the CSS I got the following errors:

314  Parse Error * { margin: 0px; padding: 0px; }
327 Parse Error }@charset “UTF-8”;
364 ul.dropdown li Property zoom doesn’t exist : 1 1
394 Parse Error }@charset “UTF-8”;

I have a few problems with this:

  1. Where did the “” come from?
  2. The line “@charset “UTF-8″” doesn’t appear in my CSS at all. (It should do but I took it out test something)
  3. My CSS file is only 311 lines long!

The Solution
To start with, I know what “” means – it is the Byte Order Mark used by “UTF-8 with BOM” which I have discussed before. The weird thing is that I’m using “UTF-8 without BOM” throughout my site so I shouldn’t get this at all (I double checked just to be sure). Weird.

After a while I had an inkling that it might be the validator that was causing problems…and I was right. I uploaded the CSS file to our live server and validated it from there – the test came back 100% valid.

I’m not sure what it’s doing to cause this but I might have an idea… I’m using Notepad++ which includes a plug-in called TextFX which includes an option to “submit to W3C CSS validator”. I’m not really sure how to use it as all it does is create a new “temp.htm” document which consists of the CSS with a bit of HTML wrapped around it. I think that the Wed Developer Toolbar is doing something similar. My guess is that this is mixing “UTF-8 with BOM” HTML with my “UTF-8 without BOM” CSS which results in a BOM being inserted and being interpreted wrongly. This then has a knock-on effect and causes the other errors (the inserted HTML would also account for the discrepancies in line numbers). Either way I just spent 1/2 an hour trying to figure out what I’d done wrong when the answer was NOTHING!

Ah well, time for lunch.


About Mr Chimp

I make music, draw pictures, browse the internet, programme, and make sweet, sweet cups of tea until the early hours.
This entry was posted in Uncategorized. Bookmark the permalink.

3 Responses to W3C Local CSS Validator Errors

  1. Skilldrick says:

    That’s the worst kind of debugging, when you’re debugging somebody else’s bug :P

    p.s. I like the fact that one of your commonly used tags is ‘anger’ :) That just sums you up, an angry, angry man.

  2. Mr Chimp says:

    The “Anger” is part of the group of tags that I use on Microsoft tags: Anger -> Hate -> Suffering.

    I hope I don’t have to tell you where that comes from…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s