Clarification of Answer by
27 Jul 2002 03:44 PDT
Thanks for the comments.
Yes, this is valid CSS. You can test it using the official validator:
W3C CSS Validator
If you enter the following, it validates:
Now, if we go to the W3C CSS2 specification, we can look up the margin
W3C CSS2 Specification
"Negative values for margin properties are allowed, but there may be
So, as with most of the CSS you will write, there is no guarantee it
will work in all current, and future browsers. The important thing to
keep in mind is: when a certain property-value is ignored or
misunderstood by the browser, is the content still readable? In your
case, the fallback -- that is, a border above and below the textarea
-- would be relatively harmless. The best thing one can do is check in
popular browsers today, and make sure it validates according to the
World Wide Web Consortium to be prepared for the future.
As to why the whitespace is there, this one baffled me too. I
cross-checked in the Mozilla1 rendering engine, and by my
understanding setting a padding style of zero to the wrapping
td-element should have done the job (I also removed whitespace before
and after the td, so that the textarea element would immediately
follow). You already did the same thing with the cellpadding of zero.
However, after many tries, the approach outlined in the original
answer was the only one that worked.
W3C HTML4 Specification - Cell margins
W3C CSS2 Specification - Tables
Hope that helps!