使用CSS为每个打印页面添加边框? [英] Add borders to each printed page with CSS?

查看:602
本文介绍了使用CSS为每个打印页面添加边框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在CSS或js中可以在打印的媒体中模拟以下格式(例如,显示每个页面的边框,页面号和一些文本在角落,内容很好地分割 - 而不是一半)?

Is it possible in CSS or js to emulate the following format in printed media (eg showing borders for each page, with a page number and some text in the corner, with the content nicely split - and not chopped in half)?

>

我一直使用 page-break-after 来分割内容,但没有找到一种方法来添加这种边框/页码。这只需要在WebKit中工作。

I have been using page-break-after to split the content up, but havn't found a way to add this kind of border/page number to each page. This only needs to work in WebKit.

有关详细信息,我这样做的原因是我使用wkhtml将HTML文档打印到PDF。

For further information, the reason I am doing this is I am printing HTML documents to PDF using wkhtml.

推荐答案

尝试使用打印媒体类型。

Trying using the print media type.

@media print {
...
}

有关利用打印介质类型的信息和教程。 / a>

Information and tutorial on leveraging the print media type.

教程对CSS打印页面打印

这篇关于使用CSS为每个打印页面添加边框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆