4
這裏有一個示例代碼:箱尺寸:如何在Firefox中擺脫滾動條填充
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Sample Textarea</title>
<style type="text/css">
* {width:100%; height:100%; margin:0; border:0; padding:0; background:#D3D3D3;}
textarea {overflow:auto; box-sizing:border-box; -moz-box-sizing:border-box; padding:6px;}
</style>
</head>
<body>
<form action="#">
<textarea rows="1" cols="1">This is some text.</textarea>
</form>
</body>
</html>
我用箱大小屬性來設置textarea的寬度爲100%,加上一些填充和它的工作原理在所有主流瀏覽器中。但是,在Firefox中,如果向textarea添加更多內容,則會在滾動條周圍看到不需要的填充。
感謝您的回答,但行高太多,正如您所說,看起來很尷尬! – Mori 2011-12-31 17:42:05