textarea的行为在IE和Firefox中有所不同

时间:2013-02-10 23:57:48

标签: html css textarea

我有以下代码:

的test.html:

 <textarea class ="errortext" rows="1" cols="30" value=""> </textarea>

test.css:

textarea.errortext {
    white-space: nowrap;
    overflow-y:  hidden;
    overflow-x:  hidden;
    overflow:    -moz-scrollbars-horizontal;
    width:auto; height:auto;
    position:absolute;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
   }

在IE中它按预期工作我看到一个包含1行和30个colomns的框,并且该框不可调整大小。在Firefox中,这不是真的,盒子是可以抵抗的。

我该如何解决这个问题?

2 个答案:

答案 0 :(得分:2)

如果我理解正确,为了防止textarea在FF中重新调整大小,请将以下内容添加到您的选择器中:

textarea.errortext {
    resize:none;
}

答案 1 :(得分:0)

您需要添加resize: none

相关问题