Google Chrome打印分页符 [英] Google Chrome Printing Page Breaks
本文介绍了Google Chrome打印分页符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图让google chrome做分页符。
I'm trying to get google chrome to do page breaks.
我已经通过一些网站告诉 break-after:always;
在chrome中有效,但我似乎无法使它工作,即使有一个非常简单的例子。在打印chrome时是否有任何方式强制分页?
I've been told via a bunch of websites that page-break-after: always;
is valid in chrome but I can not seem to get it to work even with a very simple example. is there any way to force a page break when printing in chrome?
推荐答案
包括Chrome的浏览器:
I've used the following approach successfully in all major browsers including Chrome:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Paginated HTML</title>
<style type="text/css" media="print">
div.page
{
page-break-after: always;
page-break-inside: avoid;
}
</style>
</head>
<body>
<div class="page">
<h1>This is Page 1</h1>
</div>
<div class="page">
<h1>This is Page 2</h1>
</div>
<div class="page">
<h1>This is Page 3</h1>
</div>
</body>
</html>
这是一个简化的例子。在实际代码中,每个页面div包含更多元素。
This is a simplified example. In the real code, each page div contains many more elements.
这篇关于Google Chrome打印分页符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文