使用CSS为每个打印页面添加边框? [英] Add borders to each printed page with 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 {
...
}
Information and tutorial on leveraging the print media type.
这篇关于使用CSS为每个打印页面添加边框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!