gpt4 book ai didi

最后打印页面的 HTML 页脚

转载 作者:行者123 更新时间:2023-12-03 22:44:12 24 4
gpt4 key购买 nike

我想打印我的 html 页面。我有超过 1 页,我只想在最后一页的底部打印我的页脚。我的CSS

@page {
size: 8.5in 11.0in;
margin-left: 0.7cm;
margin-top: 0.7cm;
margin-top: 0.7cm;
margin-bottom: 2.6cm;
margin-right: 0.5cm
}

#footer {
clear: both;
position: running(footer);
z-index: 10;
margin-top: -1em;
vertical-align: bottom;
height: 5%;
}

@page {
@bottom-center {
content: element(footer);
}
}

HTML:
<body><div id="content"></div>
<div id="footer"></div>
<body>

它有效,但是当我的内容最终有非常大的表格时,例如 6 页表格,我的页脚会填充所有带有表格的页面。

最佳答案

已解决:下面的 CSS 代码将仅在 PDF 的最后一页显示页脚或任何内容。

<style type="text/css" media="print">    
@page {
size: A4 portrait;
padding-left: 8px;
padding-right: 0px;
margin-top: 50px;
margin-bottom: 150px;

@bottom-center {width: 100%; content: element(footer)}
}

@media print {
.footer {
left: 0;
width: 100%;
position: running(footer);
height: 200px;
}
}
</style>



<div class="footer">
Content Here
</div>

关于最后打印页面的 HTML 页脚,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27448199/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com