Clarification of Answer by
j_philipp-ga
on
27 Jul 2002 03:44 PDT
Hello Davious,
Thanks for the comments.
Yes, this is valid CSS. You can test it using the official validator:
W3C CSS Validator
http://jigsaw.w3.org/css-validator/validator-text.html
If you enter the following, it validates:
textarea
{
margin-top: -1px;
margin-bottom: -1px;
}
Now, if we go to the W3C CSS2 specification, we can look up the margin
property:
W3C CSS2 Specification
http://www.w3.org/TR/REC-CSS2/box.html#propdef-margin
"Negative values for margin properties are allowed, but there may be
implementation-specific limits."
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.
References:
W3C HTML4 Specification - Cell margins
http://www.w3.org/TR/1998/REC-html40-19980424/struct/tables.html#h-11.3.3
W3C CSS2 Specification - Tables
http://www.w3.org/TR/REC-CSS2/tables.html
Hope that helps!