2017-08-25 36 views
-7

如何在textarea中刪除底部填充?如何刪除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>

+1

沒有填充,我看不到它 – PRAISER

+0

您正在使用哪種瀏覽器? –

+0

你可能想看看這個https://stackoverflow.com/questions/995168/textarea-to-resize-based-on-content-length – Kiwad

回答

1

您應該使用

溢出-Y:隱藏

爲folows

$('textarea').css("height", $("textarea").prop("scrollHeight"))
textarea { 
 
    width: 300px; 
 
    resize: none; 
 
    margin: 0; 
 
    padding: 0; 
 
    overflow-y: hidden; 
 
}
<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>