【发布时间】:2016-07-07 16:49:40
【问题描述】:
我有一个这样设置的对话框:
<div style="position:fixed; display:block; width:600px; top:0; left:50%;margin-left:-275px;">
<table style="width:100%;" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>
<div class="modal-header">
<span class="close">×</span>
<h2>Modal Header</h2>
</div>
</td>
</tr>
<tr>
<td style="background-color:gray;">
<table>
<tbody>
<tr>
<td>
<div class="modal-body">
<p>variable length really long stuff</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<div class="modal-footer">
<h3>Modal Footer</h3>
</div>
</td>
</tr>
</tbody>
</table>
</div>
现在,对话框的内容对于页面来说太长了,而且由于位置是固定的,用户永远无法向下滚动到对话框的底部。我希望仅当内容的长度超过视口区域时内表才可滚动 - 但我总是希望页眉和页脚可见。
Here is a code sample.我怎样才能做到这一点?
【问题讨论】:
-
您希望模态框始终保持 100% 高度吗?页眉和页脚的高度是固定的吗?
-
@Pangloss 模态框最多只能与其中的内容一样高,但如果内容不能放在一页中,则应该是可滚动的。是的,页眉和页脚是固定高度,但模态内容会根据服务器而变化。
标签: html css dialog html-table