Previous Message
Next Message

Validator Woes

Sent by Adam Kuehn on 27 September 2005 15:03

BJ wrote:

>I just this morning got caught by similar. How many of us have used this?
>.clearA {
>	overflow: hidden;
>	clear:both;
>	height:0;
>	margin:0;
>	font-size: 1px;
>	line-height: 0;
>It no longer validates and is probably used in every dang stylesheet 
>I've got out there . . .
>Once I changed it to line-height: .01em; it validates.

Do you have any reason to believe that a line-height of 0 is invalid? 
When in doubt, check the spec. [1]  As you can see, the value of 
line-height can be a length. [2]  Length units are specifically 
allowed to be zero, and the line-height definition explicitly states, 
"Negative values are illegal."  (And therefore, by implication, zero 
values are allowed.)  Further, if you add any unit to your zero 
value, suddenly the validator stops throwing a parse error 
complaining about an empty string.  And again checking the spec [2], 
the length unit indicator is explicitly optional for zero values. 
Clearly, therefore, the validator is broken in this respect.  I filed 
a bug report.

More generally, please remember that the validator is a tool.  It 
helps you to check your work, but it is a computer program and not an 
adequate substitute for reasoned human judgment.  If you find a place 
where the spec and the validator disagree, the spec is correct.  This 
is doubly so when the properties flagged continue to work just as 
they always have in actual browsers.  Neither Mozilla, nor IE, nor 
Opera, nor Safari are directly connected to the validator in any way.

So don't worry about every dang stylesheet you have out there.  They 
all still work just fine.

1. <>
2. <>


-Adam Kuehn
css-discuss [EMAIL-REMOVED]]
List wiki/FAQ --
Supported by --
Previous Message
Next Message

Message thread: