Coding with Jesse

Unitless Line Heights Are Finally Valid

January 15th, 2007

It's a miracle! There is a new W3C CSS Validator. I checked, and it's true, Unitless Line Heights are now considered valid!

Back in February, Eric Meyer wrote about Unitless Line Heights, explaining that you don't need to put px, pt, % or em at the end of a line height, and you don't even need decimals. Unfortunately, for a long time, the W3C CSS validator said that this was invalid:

body { line-height: 1 }

Oddly, if you changed it to 1.0, it became valid.

I took the challenge, and downloaded the Java source code of the validator. After reading through the code for a few hours, I found the problem. At the core of the bug, it was requiring the value to be a Float but not a regular Number.

Anyway, on February 11th, 2006, I sent in a patch to fix the problem.

And now, about a year later, the live validator is finally fixed. Now we can all rejoice by having our valid CSS actually validating.

About the author

Jesse Skinner Hi, I'm Jesse Skinner. I'm a self-employed web developer with over two decades of experience. I love learning new things, finding ways to improve, and sharing what I've learned with others. I love to hear from my readers, so please get in touch!