我目前正在尝试将以下布局从表格转换为div。它具有以下特点:
如何在DIV中完成此操作而不是表格?
到目前为止,这是我的代码:http://jsfiddle.net/zhz2m/1/
<table width="100%" height="100%" id="container">
<tr>
<td height="85%" id="top"><div id="chat" style="height: 100%; overflow: scroll-y">
<h2>Innovation Week 2013 - Virtual Idea Wall</h2>
</div></td>
</tr>
<tr>
<td height="10%" id="bottom"><form id="send-message">
<p>
<label for="title">Please give your idea a title</label>
<br />
<input type="text" id="title" name="title"/>
</p>
<p>
<label for="message">Please provide details of your idea</label>
<br>
<input type="text" id="message" name="message"/>
</p>
<p>
<input type="submit">
</p>
</input>
</form></td>
</tr>
</table>
答案 0 :(得分:2)
看看这个小提琴:
定义高度,位置固定和溢出行为。
CSS:
#main {
width: 100%;
height: 80%;
min-height: 80%;
max-height: 80%;
position: fixed;
overflow: scroll;
}
#footer {
width: 100%;
height: 20%;
min-height: 20%;
max-height: 20%;
position: fixed;
bottom: 0;
background-color: orange;
}
标记:
<div id="main">content</div>
<div id="footer">fixed at bottom</div>