CSS Validator Nonsense

— Topic: CSS

Seeking Clarity

If you’ve been doing web design for awhile, you’ll remember the old days of table based layout. For me, the dawn of CSS and web standards was when I really started taking an interest in best practices. I liked the exactness that it called for – a certain level of precision as opposed to nesting tables within tables, and throwing down a font-tag to change an element’s color.

That being said, I fear that perhaps the W3C has gone a bit overboard recently, adding unnecessarily strict warning messages to every instance in which a background-color is not accompanied by a color and vice-versa. I find this very odd, because this is not something that native, unstyled HTML does by default anyways. It’s as if they’re saying “Hold on there cowboy – You can’t change the color of a blue link without also adding a background-color!”

Examples

For instance, on this site I change the color of h3 to make them stand out a little bit from the regular text, besides just having a change in font. This still passes validation as clean CSS, but as of late this has started throwing a ridiculous amount of warnings. Don’t believe me? Check out any of your favorite sites, and I guarantee that you’ll see something like this…

  • (Level : 1) You have no background-color with your color : h3

Oh the horror, I’ve been slapped with a Level 1 warning! Let me point out that this is not the same as having non-valid CSS. If you’re worried only about that, you can quit reading. This would be the equivalent to a cop stopping you at an intersection with nobody at it, and saying “Um, Mister – You didn’t come to a full and complete stop at that stop-sign.” You’d be thinking “So what? There’s nobody here, so there wasn’t any harm done.”

Here’s another example:

  • a { color: blue; }
  • (Level : 1) You have no background-color with your color: a

The warning above is how default HTML works! Before you say it – I understand the accessibility reasoning behind this type of warning. You wouldn’t want white text on a white background, for instance, or too faint of a grey to be legible. To its credit, the validator can tell when a background color is the same as the foreground color, and gives you a warning for that too.

Suggestions

After a little Googling around, from what I can gather, the W3C added this pleasant bit of validation somewhere around the middle of September. To me though, it is so arbitrary that it really is not a very reliable warning. I think it would have been better if they had added some sort of native intelligence to the check, based on the nearest parent element.

For instance, if I have a div that has a white background, and have defined everything within it to have black text, then if you change something to a dark green, it should check how far in hex-color that is from the white background, and if it’s above X amount in variation, then it should give you a warning. That’s the type of validator I’d like to see, not something that just throws out random warnings In my opinion, it completely devalues more important ones.

Anyway, that’s just the way I see it. I’m sure that there will be people that disagree, but I think we need to have real warnings where they’re truely applicable, and quit sending knit-picky designers (like me) into a panic. Hopefully there are enough of us in agreement that the W3C will listen and do something about it.

Powered by Fusion Ads
 

JS Tutorial, JavaScript Tutorial, JavaScript Guide, Learn JavaScript JS, How To Learn JS, Learning JavaScript
Promote JavaScript


Disclaimer

The thoughts and opinions expressed here are mine alone, and are not necessarily shared by any other living person.