【发布时间】:2012-12-24 09:29:08
【问题描述】:
我有一个包含课程的页面,我想打印这个页面,我想在打印模式下的每个页面中添加页脚(当前课程名称、当前课程创建日期)。
<html>
<head>
<style>
.footer {
display:none;
}
@media print {
.Lesson
{
page-break-after:always;
}
.footer {
display:Block;
}
}
</style>
</head>
<body>
<div id="lesson1" class="Lesson">
lesson text
<div id="print-footer print-footer1" class="footer">footer 1 content</div>
</div>
<div id="lesson2" class="Lesson">
lesson text
<div id="print-footer print-footer2" class="footer">footer 2 content</div>
</div>
<div id="lesson3" class="Lesson">
lesson text
<div id="print-footer print-footer3" class="footer">footer 3 content</div>
</div>
<div id="lesson4" class="Lesson">
lesson text
<div id="print-footer print-footer4" class="footer">footer 4 content</div>
</div>
</body>
</html>
【问题讨论】:
-
我可以添加固定页脚,但不能在打印预览的每一页上添加不同的页脚。
-
我们可以看看你的代码吗?
-
是否可以在每一页上打印不同的页脚?
-
@OllyHodgson,请检查我的代码
-
@AmirSalah 部分问题可能是
id="print-footer print-footer1",这是无效的。class是一个以空格分隔的列表,而不是id。