Textarea height Chrome problem
Is anyone have solution for textarea height problem in Chrome?
In simple case like this:
<div>
<textarea>
</textarea>
</div>
Google Chrome add two pixels, so div.height = textarea.height + 2px. And yes, I try Eric's "reset.ccs" — didn't work.
P.S. of course in m开发者_C百科y "simple case" textarea and div have border, padding and margin 0px.
It's because textarea
is a replaced inline element.
textarea {
display:block;
}
should solve your "problem".
The 2px
is the standard border size. It's the same across all browsers though.
This works in Chrome, Firefox..
No borders : http://jsfiddle.net/NctDT/2/
Borders and ajusted div
height : http://jsfiddle.net/NctDT/4/
In both cases the div
and textarea
are both perfectly aligned in height.
Sorry, But adding
html,body{
height:100%;
}
really seems to work
精彩评论