考慮這個例子http://plnkr.co/edit/xnyrIy1LLZLIBAs6VIOr?p=preview使內容佔據整個頁面的CSS +引導
我只是試圖讓textarea的佔用面板的整體高度,面板佔據了首頁的整個頁面。但是,由於某種原因它溢出了。這是爲什麼?
<html>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet">
<style>
body, html{
box-sizing: content-box;
background-color:#eeeeee;
height:100%;
overflow:hidden;
}
textarea{
box-sizing: content-box;
resize: none;
height: 100% !important;
width:100%;
}
.form-control, .panel, .container {
box-sizing: content-box;
margin: 10px;
height: 100%;
}
</style>
<body>
<div id="c2">
<div id="c1">
<div class="container">
<h1>Hello, hello!</h1>
<div class="panel">
This is the panel<br><br>
<textarea class="form-control">
</textarea>
</div>
</div>
</div>
</div>
</body>
</html>
謝謝,修復textarea的問題。但面板和textarea仍然佔據了頁面的100%以上。 (刪除溢出:隱藏,你會看到) – user1506145 2014-11-06 17:54:45
@ user1506145看看編輯。 – 2014-11-06 18:13:32
如果我刪除高度100%的面板和textarea仍然溢出頁面大小。我希望面板和textarea在滾動禁用時佔據頁面。看看這裏http://plnkr.co/edit/xnyrIy1LLZLIBAs6VIOr?p=preview – user1506145 2014-11-06 18:20:36