2017-04-06 120 views
1

我有一张表,我想用JS打印window.print();。 但是,当这个表有太多的行oter页这么想的保护seted利润率JS窗口打印页边空白表

enter image description here

我的CSS:

@page { size: auto; margin: 0px; } 
html { background-color: #FFFFFF; margin: 0px; } 
body { margin: 10mm 10mm 10mm 10mm; } 
tbody > td > span { font-size: 14px !important; } 

我如何可以强制此表打破了保持利润?

点击任何元素上进行打印:https://jsfiddle.net/kfubawpg/

+0

你是什么意思是什么呢?以下页面头部的“顶部边距”? – Legends

+0

缺口表的边缘和边缘底部 – gFontaniva

回答

1

你有@page边距设置为0。只要将它改为你想要的边距的大小。

@page { size: auto; margin: 50px; } 

fiddle

+0

这解决了我的问题 – gFontaniva

0

你可以做到以下几点:

@page :first { // set the margins for the first page in print mode 
     margin: 100px; 
    } 

    @page { // set the margins for all following pages (tables) in print mode 
    size: auto; 
    margin-top: 10px; 
    margin-bottom: 10px; 
    } 

Here is a demo