开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜