简体   繁体   English

print.css 在不同的浏览器上看起来不同

[英]print.css looks different on different browsers

I have a page from which the user can print.我有一个用户可以打印的页面。 But the print is not supposed to print everything just certain elements.但是打印不应该只打印某些元素。

So I have a print.css file that takes care of that:所以我有一个 print.css 文件来处理这个问题:

body{
    font-size:2.5em;
}

container-a{
    display: none;
}

container-b{
    display: none;
}

container-c{
    height: 50%;
    border-bottom: 2px solid black;
}

container-d{
    height: 50%;
    border-bottom: 2px solid black;
}

I develop on my Ubuntu machine with Chrome version 79.0.3945.88.我在 Chrome 版本 79.0.3945.88 的 Ubuntu 机器上进行开发。 So when I click Ctrl + P everything looks fine.因此,当我单击Ctrl + P时,一切看起来都很好。

But then once I deployed and go check from my Windows machine with Chrome version 80.0.3987.163, the format is all wrong.但是,一旦我部署并 go 从我的 Windows 机器检查 Chrome 版本 80.0.3987.163,格式都是错误的。 The font size is way too big which causes only half to be displayed on the print page.字体太大,导致打印页面上只显示一半。

I tried using set values like 22px for the font size instead of 2.5em but that didn't change anything.我尝试使用诸如22px之类的设置值来代替2.5em字体大小,但这并没有改变任何东西。 In fact I have to go to the advanced settings and set the scale from "default" to "custom 60%" which then makes the print page look like my print page on my dev machine.事实上,我必须将 go 设置为高级设置,并将比例从“默认”设置为“自定义 60%”,然后使打印页面看起来像我的开发机器上的打印页面。

Why is there a difference?为什么有区别? I thought since I use % and em it should look the same every where?我想既然我使用 % 和 em 它应该在每个地方看起来都一样?

Smart as I am, the paper size options were not the same in both browsers.虽然我很聪明,但两种浏览器的纸张尺寸选项都不相同。

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

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