我的网页仅打印到一页(没有中断)

发布于 2024-09-29 17:54:08 字数 99 浏览 0 评论 0原文

我在打印信息网页时遇到问题,该信息应该跨越大约 3 页。目前只打印了1页,其余数据在任何地方都看不到?是否有一些 JS 或 HTML 我可以用来中断页面,并允许信息继续打印在下一页上。

I'm having trouble printing a web page of information, which should span onto about 3 pages. Currently, only 1 page is printed, and the rest of the data is not visible anywhere? Is there some JS or HTML I can use to break the page, and allow the information to continue being printed on the next pages.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我们只是彼此的过ke 2024-10-06 17:54:08

您需要一个打印样式表,并且它的高度应设置为“自动”,溢出设置为主体的“可见”。我所做的就是这样:

@media print {
    html, body { height: auto; overflow: visible; }
}

只需将其放入您的主 CSS 文件或它自己的文件中。

You need a print stylesheet, and it should have height set to "auto" and overflow set to "visible" for the body. What I do is something like:

@media print {
    html, body { height: auto; overflow: visible; }
}

Just put that in your main CSS file or in a file of its own.

故事还在继续 2024-10-06 17:54:08

A List Apart 上有一篇非常好的文章,介绍了如何准备要打印的网站。

有一个已知的错误,浮动的 div 被切断,可能值得您看一下。

A List Apart / CSS Design:即将打印(请参阅部分:修复浮动错误)

希望这有帮助!

There's a pretty good article on A List Apart about preparing your site for print.

There is a known bug with floated divs getting cut off, it might be worthwhile for you to take a look.

A List Apart / CSS Design: Going to Print (See the section: Fixing a float flub)

Hope this helps!

往事风中埋 2024-10-06 17:54:08

你也可以强制休息

<style>
.break { page-break-before: always; }
</style>
<body>
content on page 1...
<h1 class="break">text of Heading 1 on page 2</h1>
content on page 2...
<h1 class="break">text of Heading 1 on page 3</h1>
content on page 3...
<p class="break">content on top of page 4</p>
content on page 4...
</body>

You can also force your breaks

<style>
.break { page-break-before: always; }
</style>
<body>
content on page 1...
<h1 class="break">text of Heading 1 on page 2</h1>
content on page 2...
<h1 class="break">text of Heading 1 on page 3</h1>
content on page 3...
<p class="break">content on top of page 4</p>
content on page 4...
</body>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文