在textarea中禁用包装的代码在webkit中完美运行,但在firefox中则不行。
演示(webkit):http://jsfiddle.net/cuk2072g/2/
代码:
#textArea {
color: red;
height: 200px;
width: 300px;
text-align: left;
white-space: nowrap;
overflow: hidden;
resize: none;
}
#textArea::-webkit-input-placeholder {
color: green;
white-space: nowrap;
overflow: hidden;
}
<textarea class="form-control" id="textArea" placeholder="_____________________________________________________________________________________________________________">
</textarea>
Webkit完美无瑕,但Firefox有问题......
演示(firefox):http://jsfiddle.net/g7CsP/3/
代码:
#textArea {
color: red;
height: 200px;
width: 300px;
text-align: left;
resize: none;
}
#textArea::-moz-placeholder {
color: green;
white-space: nowrap;
overflow: hidden;
}
<textarea class="form-control" id="textArea" placeholder="_____________________________________________________________________________________________________________">
</textarea>
答案 0 :(得分:0)
我在这里找到了解决方案:它是第二高的答案 How remove word wrap from textarea?
CSS:
#textArea {
color:red;
height: 200px;
width: 300px;
text-align:left;
word-wrap: normal;
resize:none;
}
#textArea::-moz-placeholder {
color:green;
}