简体   繁体   English

使用CSS打印页面并控制页眉和页脚

[英]Print pages and control headers and footers with CSS

I have created a page which replicates the layout of an A4 piece of paper. 我创建了一个页面,该页面复制了A4纸的布局。 While the content may spill off the bottom of the document when I print it looks fine and splits it in the print preview (I'm using Chrome v45 but ideally this would work in all major browsers). 虽然内容在我打印时可能会从文档底部溢出,但看起来很不错,并且可以在打印预览中将其拆分(我使用的是Chrome v45,但理想情况下,它可以在所有主流浏览器上使用)。

Now I'd like to be able to control the headers and footers for certain pages. 现在,我希望能够控制某些页面的页眉和页脚。 First page only might a header but all pages might have a footer. 仅第一页可能有页眉,但所有页面可能都有页脚。

I have being going round in circles with this and I just want to know if this would be possible? 我一直在绕圈转,我只想知道这是否可能?

There is a similar question here How to use HTML to print header and footer on every printed page of a document? 这里有一个类似的问题, 如何使用HTML在文档的每个打印页面上打印页眉和页脚? look at the answer by Infotekka - as that might give you a good starting point. 查看Infotekka的答案-那样可能会为您提供一个很好的起点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM