我在使用 Firefox 打印时遇到网站布局问题。 我做了一些研究,发现这个可以解决 firefox 问题:
@-moz-document url-prefix()
所以我尝试像这样将它与媒体查询结合起来,但是没有用。
@-moz-document url-prefix() {
@media print {
.someclass {
color: red;
}
}
}
这也行不通
@media print {
@-moz-document url-prefix() {
.someclass {
color: red;
}
}
}
单独使用 @-moz-document url-prefix() 就可以了。
我是不是哪里做错了,或者这只是一个愚蠢的开始?还有别的办法吗? 现在我的所有样式都在 head 标签中。
最佳答案
这可以帮助你。如果您使用的是 Firefox,它只会添加打印样式。
注意:您需要 jQuery为此。
<script type="text/javascript">
if ( $.browser.mozilla == true ) {
$('head').append(' <link rel="stylesheet" type="text/css" href="print.css" media="print">');
}
</script>
关于html - 我可以只为 firefox 编写打印样式吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46319010/