I get an extra space above the below textarea, but only in ie. How to fix it?
<div class="field">
<label>Info</label><textarea cols="40" rows="4"></textarea>
</div>
.field {
margin: 0px;
margin-top: 2px;
}
label {
display: inline-block;
width: 5em;
margin-right: 0.5em;
}
textarea {
display: inline-block;
width: 22em;
vertical-align: text-top;
}
If I put a whitespace between label and textarea tags the space disappears. But then I get a horizontal extra space between them.
Edit: I found, the problem appears with doctype - transitional. With strict everithing is ok. Is there a way, to fix it with transtional?
I can reproduce your issue. See the end of my answer for exact details.
You can remove the gap by:
vertical-align: text-top
tovertical-align: top
.Unless you desperately need
text-top
for some reason (why?), this is an easy remedy.I'm not sure why
text-top
adds the extra space at the top with theTransitional
doctype.Testing in IE8, with this code (
XHTML 1.0 Transitional
), your described issue happens:If I change the first line to this (
XHTML 1.0 Strict
), it doesn't happen: