我想让表格固定在页眉和页脚之间

发布于 2024-09-11 17:01:34 字数 357 浏览 2 评论 0原文

我创建了一个包含三个部分的 HTML 页面。顶部有一个页眉,中间有两个表格,底部有一个页脚。所有这三个都在三个 div 中定义。使用 css 属性 (top:0px; position:fixed;) 将页眉固定在顶部,同样,使用 css 属性将页脚固定在底部 (>底部:0px; 位置:固定;)。

在所有情况下,表格都必须固定在页眉和页脚之间,即当浏览器放大或缩小时,表格必须固定在页眉和页脚之间。

更具体地说,表格的顶部必须粘在页眉的底部,表格的底部必须粘在页脚的顶部,我认为表格必须表现出一定的流动性。有这样的事吗。

有人可以帮忙吗?

I have created a HTML page with three section. One header at the top, two a table at the middle and a footer at the bottom. All the three is defined in three divs. The Header is fixed at the top using the css property ( top:0px; position:fixed;), likewise the footer is fixed at the bottom using css property (bottom:0px; position:fixed;).

The table have to be fixed in between the header and footer in all conditions, ie when the browser is zoomed in or zoomed out the table have to be fixed between the header and footer.

To be more specific the top of the table have to stick to the bottom of the header and the bottom of the table have to stick to the top of the footer, I think the table have to exhibit some fluid property. Is there any thing like that.

Can anyone help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

路还长,别太狂 2024-09-18 17:01:34

请尝试以下操作:

<html>
<body style="height:100%;width100%;padding:0;margin:0">

<div style="position:fixed:top:0;width:100%;height:10%;background-color:red;">
    Header
</div>
<div style="position:fixed:top:10%;width:100%;height:80%;background-color:green;overflow:auto">
    <table>
      <tr><td>Table / Middle</td></tr>
   </table>
</div>
<div style="position:fixed:top:90%;width:100%;height:10%;background-color:blue;">
    Footer
</div>

</body>
</html>

Try the following:

<html>
<body style="height:100%;width100%;padding:0;margin:0">

<div style="position:fixed:top:0;width:100%;height:10%;background-color:red;">
    Header
</div>
<div style="position:fixed:top:10%;width:100%;height:80%;background-color:green;overflow:auto">
    <table>
      <tr><td>Table / Middle</td></tr>
   </table>
</div>
<div style="position:fixed:top:90%;width:100%;height:10%;background-color:blue;">
    Footer
</div>

</body>
</html>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文