如何删除textarea
中的底部填充?
$('textarea').css("height", $("textarea").prop("scrollHeight"))
textarea {
width: 300px;
resize: none;
margin: 0;
padding: 0;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<textarea>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a </textarea>
答案 0 :(得分:1)
你应该使用
溢出-y:隐藏
如下:
$('textarea').css("height", $("textarea").prop("scrollHeight"))
&#13;
textarea {
width: 300px;
resize: none;
margin: 0;
padding: 0;
overflow-y: hidden;
}
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<textarea>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a </textarea>
&#13;