作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想打印我的 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);
}
}
<body><div id="content"></div>
<div id="footer"></div>
<body>
最佳答案
已解决:下面的 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/
我是一名优秀的程序员,十分优秀!