可以只用CSS扩展textarea? [英] It is possible to expand a textarea only with CSS?
本文介绍了可以只用CSS扩展textarea?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个textarea高度为200px,但是当我通过那个200px的文本,我想有textarea扩展,而不是保持200px的高度与滚动条。
I have a textarea with 200px of height, but when I pass that 200px with text I want to have the textarea expanded instead of keeping the 200px of height with a scroll bar.
code>,您可以使用使用 div
contentEditable 属性:
Instead of textarea
, you can use div
with contentEditable attribute:
标记:
<div contentEditable="true"></div>
css:
div {
display:inline-block;
border: solid 1px #000;
min-height: 200px;
width: 300px;
}
这篇关于可以只用CSS扩展textarea?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文