嘗試使用rows Attribute:
<textarea rows="4" >
This should force the text area to only show 4 lines, or 5, as you desire.
</textarea>
無論如何,我認爲你可以檢查你的文字的大小面積或 計算屬性,點擊「檢查」上您的瀏覽器( 示例chrome)。然後點擊樣式/計算,你會看到你正在申請的 樣式。
屬性的圖像:
編輯:
從來就試圖使小提琴想想哪個屬性打破它, 試它。它似乎你需要尋找你的css`s :)內textarea:focus
或類似
更改片段顯示padding屬性可怎麼也影響大小
#editor1 {height: 10px;}
#editor1:focus {height: 20px;}
#editor2:focus { padding-bottom: 10px;}
<textarea id="editor1" placeholder="Check it!!"></textarea>
<textarea id="editor2" placeholder="Check it!!"></textarea>
解決後改進與OP評論:
I did actually manage to find out what caused the problem. Hidden in one of the js files was some legacy code to manage resizing of textareas. As some of the pages where loading in templates on top of the actual page(in a aside/modal) the code wasnt running correctly. Thank you for taking the time. It led me to my
它必須是導致此頁面上的其他CSS,使用你的代碼,並引導其本身3.0不會產生同樣的效果 – Keith
'heigth'應該是'height' – Blazemonger
ARH是的一個類型,wasnt雖然導致了問題 –