在第一页之后打印重复的页眉
Print repeating headers after 1st page
好的,所以我做了很多研究,但什么都找不到。这是我的东西。我需要创建一个打印按钮,打印视图需要在第一页之后有重复的标题。也就是说,第一页的页眉与其他页面不同。到目前为止,这就是我所拥有的,但它在每一页上都重复,我无法制作自定义的第一页页眉。如有任何帮助,我们将不胜感激!
<!DOCTYPE html>
<html>
<head>
<style>
.section {
display: table;
width: 100%;
}
.section > div {
display: table-cell;
overflow: hidden;
}
.section ~ .section > div:before {
content: "";
display: block;
margin-bottom: -2.5em; /* inverse of header height */
}
.section > div > div {
page-break-inside: avoid;
display: inline-block;
width: 100%;
vertical-align: top;
}
.header {
height: 2.5em; /* header must have a fixed height */
}
.content { /* this rule set just adds space between sections and is not required */
margin-bottom: 1.25em;
}
</style>
</head>
<body>
<div class="section">
<div>
<div>
<div class="header">
PAGE HEADER
</div>
<div class="content">
Unbreakable section.<br/>Unbreakable section.<br/>Unbreakable section.<br/>
Unbreakable section.<br/>Unbreakable section.<br/>Unbreakable section.
</div>
</div>
</div>
</div>
<div class="section">
<div>
<div>
<div class="header">
PAGE HEADER
</div>
<div class="content">
Unbreakable section.<br/>Unbreakable section.<br/>Unbreakable section.
</div>
</div>
</div>
</div>
<div class="section">
<div>
<div>
<div class="header">
PAGE HEADER
</div>
<div class="content">
Unbreakable section.<br/>Unbreakable section.<br/>Unbreakable section.
</div>
</div>
</div>
</div>
<div class="section">
<div>
<div>
<div class="header">
PAGE HEADER
</div>
<div class="content">
Unbreakable section.<br/>Unbreakable section.<br/>Unbreakable section.<br/>
Unbreakable section.
</div>
</div>
</div>
</div>
<div class="section">
<div>
<div>
<div class="header">
PAGE HEADER
</div>
<div class="content">
Unbreakable section.<br/>Unbreakable section.
</div>
</div>
</div>
</div>
<div class="section">
<div>
<div>
<div class="header">
PAGE HEADER
</div>
<div class="content">
Unbreakable section.<br/>Unbreakable section.<br/>Unbreakable section.<br/>
Unbreakable section.<br/>Unbreakable section.
</div>
</div>
</div>
</div>
<div class="section">
<div>
<div>
<div class="header">
PAGE HEADER
</div>
<div class="content">
Unbreakable section.<br/>Unbreakable section.<br/>Unbreakable section.<br/>
Unbreakable section.
</div>
</div>
</div>
</div>
<div class="section">
<div>
<div>
<div class="header">
PAGE HEADER
</div>
<div class="content">
Unbreakable section.<br/>Unbreakable section.<br/>Unbreakable section.
</div>
</div>
</div>
</div>
<div class="section">
<div>
<div>
<div class="header">
PAGE HEADER
</div>
<div class="content">
Unbreakable section.<br/>Unbreakable section.<br/>Unbreakable section.
</div>
</div>
</div>
</div>
<div class="section">
<div>
<div>
<div class="header">
PAGE HEADER
</div>
<div class="content">
Unbreakable section.<br/>Unbreakable section.<br/>Unbreakable section.<br/>
Unbreakable section.
</div>
</div>
</div>
</div>
<div class="section">
<div>
<div>
<div class="header">
PAGE HEADER
</div>
<div class="content">
Unbreakable section.<br/>Unbreakable section.<br/>Unbreakable section.<br/>
Unbreakable section.
</div>
</div>
</div>
</div>
<div class="section">
<div>
<div>
<div class="header">
PAGE HEADER
</div>
<div class="content">
Unbreakable section.<br/>Unbreakable section.<br/>Unbreakable section.
</div>
</div>
</div>
</div>
<div class="section">
<div>
<div>
<div class="header">
PAGE HEADER
</div>
<div class="content">
Unbreakable section.<br/>Unbreakable section.<br/>Unbreakable section.<br/>
Unbreakable section.<br/>Unbreakable section.
</div>
</div>
</div>
</div>
</body>
</html>
好的,另一次编辑。您应该能够使用body > .section > div:before
覆盖JUST第一节页眉,并使用.section ~ .section > div:before
覆盖所有其他页眉。
Fiddle已更新。当我用chrome打印这篇文章时,我在第一页上得到"首页",在后续页面的第一部分之前,任何部分都没有。您松开了第一页页眉的边距,因此可能需要调整间距。
Fiddle
body > .section > div:before {
content: "First Page Header";
display: block;
margin-bottom: -2.5em;
}
.section ~ .section > div:before {
content: "";
display: block;
margin-bottom: -2.5em; /* inverse of header height */
}
相关文章:
- 如何为AngularJS制作智能表中第一页和最后一页的跳过按钮
- 在第一页加载时隐藏字段,而不是在php发布之后
- JS文件未加载第一页加载
- 如何在第一页加载时使jQuery弹出消息
- 如何自动从一个页面移动到另一个页面,然后回到 html 表格中分页的第一页
- jquery手机应用程序的第一页必须是index.html
- ngTable筛选器仅适用于第一页
- Javascript(Adobe Acrobat XI)从表单第一页的输入答案填充第二页表单
- 第一页加载时,有角度的ng网格固定标题不是静态的
- 如何使自述按钮在文章的第一段之后显示图像和h3标签
- WebRTC流在第一帧之后冻结
- 自定义JQUERY未在分页页面上加载(第一页除外)
- 文本在jQuery中仅位于第一行之后的行的中心
- 链接在第一页加载时瞬间变蓝
- 使用turn.js I'I’我正试图在加载时把角落的第一页翻进去
- 区分剑道网格上一页/下一页点击与转到第一页/最后一页点击事件
- HTML分页在第一页上搞砸了,之后它工作正常
- CSS不适用于(在第一页之后)尝试使用javascript打印html页面
- jQuery 模式对话框在刷新后的第一页上工作正常,但在此之后的任何其他页面上都无法正常工作,除非刷新
- 在第一页之后打印重复的页眉