简体   繁体   English

我如何在打印时删除 html 页面中的空白?

[英]How i removed blank space in html page while printing?

I have a page where I print this page content.我有一个打印此页面内容的页面。 My problem is when the page is load a print dialogue box appears and there is empty white space at the bottom.我的问题是加载页面时会出现打印对话框并且底部有空白区域。 How do I remove this blank space?如何删除这个空白? I tried to give min-height:100vh to body but it is not working我试图给身体min-height:100vh但它不起作用截屏 . . Please also check print css另请检查打印 css

 @page { /* size: auto; auto is the initial value */ margin: 3.5mm; } @media print{ table { page-break-inside:auto; } tr { page-break-inside:avoid; page-break-after:auto; } thead { display:table-header-group; } tfoot { display:table-footer-group; } }

You have to change and check the following style values based on your content length & width.您必须根据内容长度和宽度更改并检查以下样式值。

@page { size: 100mm 50mm } /* output size */
body.receipt .sheet { width: 58mm; height: 50mm } /* sheet size */
@media print { body.receipt { width: 58mm } } /* fix for Chrome */

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

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