简体   繁体   English

打印具有不同div大小的网页

[英]Printing a webpage with varying div sizes

Is there any way to make it so divs do not get cut in half when printing multiple pages? 有什么办法可以使div打印多页时不会被切成两半? There are divs that I am trying to print that vary in size and I would like it to print so that none of them are cut off and the full div boxes appear on a single page. 我尝试打印的div大小不一,我希望打印该div,以便没有一个被切掉,并且整个div框都显示在单个页面上。 Maybe there is a way to calculate the height of each div and if one puts it over the height of the page, then put it on the next page? 也许有一种方法可以计算每个div的高度,如果将其放在页面的高度上,然后将其放在下一页上? I know I could get the length of the text within each div and maybe do it that way, but how would I go about designating a div to be printed on another page? 我知道我可以获取每个div内文本的长度,也许可以这样,但是我将如何指定要在另一页上打印的div?

Use the CSS property page-break-inside : 使用CSS属性page-break-inside

http://www.w3.org/TR/CSS21/page.html#page-break-props http://www.w3.org/TR/CSS21/page.html#page-break-props

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

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