2016-01-21 106 views
2

使用Adobe InDesign中有可能得到这样的结果:用css禁用打印机默认边距(带铬)?

enter image description here

我就先用CSS相同的结果

<style type="text/css" media="print"> 
@page 
{ 
    size: auto; /* auto is the initial value */ 
    margin: 0mm; /* this affects the margin in the printer settings */ 
} 

body 
{ 
    background-color:#FFFFFF; 
    border: solid 1px black ; 
    margin: 0px; /* this affects the margin on the content before sending to printer */ 
    } 
</style> 

,但它不可能边距设置为0。我总是有4边的边距:

enter image description here 我正在使用谷歌浏览器来做我的测试。我也试过:

enter image description here

同样的事情,在4个方面一些小的白色边缘......出了什么问题?

任何帮助将不胜感激。 JsFiddle:https://jsfiddle.net/L63dc1yd/

回答

0

我发现了这个问题。我在页面大小选择列表中没有看到“US Letter bordeless”选项。该CSS是好的,它覆盖了铬默认边距设置。

1

我认为你可以用CSS3 Media Query来解决这个问题。

@media print { 
    html,body { 
     margin: 0; 
    } 
} 
+0

谢谢,但那不起作用 – Frank

+0

@Frank你可以添加一个样本小提琴吗? – Mystika

+0

https://jsfiddle.net/L63dc1yd/ – Frank