微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

html – 具有精确A4横向尺寸的空体元素打印在2页上

演示:
print()
@page {
    size: A4 landscape;
    margin: 0;
}
html,body {
    margin: 0;                
}
html {
    background: cyan;
}
body {
    width: 297mm;
    height: 210mm;                
    background: red;
}

A4横向的尺寸正确,但打印溢出到第二页.这些发生在Win 10 Chrome 63,FF 52和Edge 41中.

When I use the portrait dimensions and print A4 Portrait,then only one page is printed as expected,without any overflow.

有没有人有这个问题的线索?它是否出现在每个平台上?

先感谢您

解决方法

used body {margin-top: -1px }

print()
@page {
    size: A4 landscape;
    margin: 0;
}
html,body {
    margin: 0;      
}
html {
    background: cyan;
}
body {
    width: 297mm;
    height: 210mm;     
    background: red;
    margin-top: -1px;
}

原文地址:https://www.jb51.cc/html/225542.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐