I want to print my html page. I have more than 1 page and I want print my footer only at the bottom of the last page. My 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);
}
}
HTML:
HTML:
<body><div id="content"></div>
<div id="footer"></div>
<body>
It works, but when I have very big table in the end my content, for example 6 pages table, my footer populates for all pages with table.
它的工作原理,但是当我的内容非常大时,我的内容,例如6页表,我的页脚填充所有页面的表格。
1 个解决方案
#1
-1
To make it more simple you could position the footer within a media query for printing another way:
为了使其更简单,您可以将页脚放在媒体查询中以便以另一种方式打印:
@media print {
body {
position: relative;
}
#printfooter {
position: absolute;
bottom: 0;
}
}
As a quick work-around suggestion. Or you use css3 with the @page extension:
作为快速解决方案的建议。或者你使用带有@page扩展名的css3:
@page:last {
@bottom-center {
content: element(footer);
}
}
For further information w3 has a pretty good documentary about CSS Paged Media Modules. 5.3, Example 7 is the information your good to go with!
有关更多信息,w3有一个非常好的关于CSS分页媒体模块的纪录片。 5.3,例7是您的好消息!
Hope one of this helps! If, or if not please let me know.
希望其中一个有帮助!如果,如果没有,请告诉我。
Best regards, Marian.
此致,玛丽安。
#1
-1
To make it more simple you could position the footer within a media query for printing another way:
为了使其更简单,您可以将页脚放在媒体查询中以便以另一种方式打印:
@media print {
body {
position: relative;
}
#printfooter {
position: absolute;
bottom: 0;
}
}
As a quick work-around suggestion. Or you use css3 with the @page extension:
作为快速解决方案的建议。或者你使用带有@page扩展名的css3:
@page:last {
@bottom-center {
content: element(footer);
}
}
For further information w3 has a pretty good documentary about CSS Paged Media Modules. 5.3, Example 7 is the information your good to go with!
有关更多信息,w3有一个非常好的关于CSS分页媒体模块的纪录片。 5.3,例7是您的好消息!
Hope one of this helps! If, or if not please let me know.
希望其中一个有帮助!如果,如果没有,请告诉我。
Best regards, Marian.
此致,玛丽安。