2016-11-04 147 views
2

這個問題可能以前已經問過,但是我找不到可以幫助我的問題。反正,我創建了一個文本框,下面的腳本:如何使文本框滾動垂直溢出CSS的HTML?

CSS:

.cln{ 
 
top:220px; 
 
width:680px; 
 
height:350px; 
 
text-align:left; 
 
overflow:scroll; 
 
white-space: nowrap; 
 
overflow:hidden; 
 
text-overflow:ellipsis; 
 
}
<input type="text" class="cln" placeholder="That is my pet right there:)" maxlength="2024"/>

的問題是,在文本框中鍵入距離市中心50% to 50%開始,從來沒有滾動到垂直滾動,就像你輸入的行一樣。 但我希望它從左上角開始,並且永遠不會跨越文本框邊框。 到目前爲止,我所能做的只是改變,刪除white-space overflow text-align等等,但沒有任何幫助。

感謝提前:)

+4

你應該使用'textarea'。 –

+0

嘗試添加textarea – weinde

回答

2

使用textarea像下面。它會自動滾動

This will scroll automatically...<br/> 
 
<textarea type="text" class="cln" placeholder="That is my pet right there:)" col=30 rows=10> </textarea>

+0

行仍然沒有滾動垂直,仍然水平 – John

+0

@John,再次檢查它 – Abk

+0

O.k只是想通了,不得不刪除'在我的CSS空白',反正謝謝 – John

0

使用textarea的不輸入

<textarea class="cln" placeholder="That is my pet right there:)" /> 
0

你能使用textarea的,而不是輸入?

<textarea type="text" class="cln" placeholder="That is my pet right there:)" maxlength="2024"/></textarea> 

Example