css - 在 Firefox 和 IE 中,-webkit-print-color-adjust 的替代项是什么

标签 css google-chrome internet-explorer firefox

我在打印背景颜色时遇到了一些问题。

print-color-adjust 解决了 chrome 中的背景颜色问题。

body{
-webkit-print-color-adjust: exact;
}

为此,firefox 和 IE 中的替代 CSS 是什么。

最佳答案

如前所述,-webkit-print-color-adjust: exact 特定于 WebKit 浏览器,包括 Google 的 Chrome 和 Apple 的 Safari;因此代码应该在上述浏览器中充分工作,结果可能略有不同(取决于您的网站/应用样式)。

有人提议将此代码段标准化,使其不仅适用于浏览器,也适用于不同的设备。代码简化为:color-adjust。与 webkit-print-color-adjust 属性类似,提议的属性 economy | 可能的值相同。准确

如果您想将该属性用于打印目的,只需在 @media print 查询中的选择器中使用即可。

例如:

@media print {
  body { color-adjust: exact; }
}

我不能保证起草的属性在浏览器上得到广泛采用,但它目前正在使用最新版本的 FireFox(在撰写本文时为 50.0 版)。

[Source]

关于css - 在 Firefox 和 IE 中,-webkit-print-color-adjust 的替代项是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35625178/

相关文章:

javascript - 光标描述文本框

html - 仅使用 css 删除没有 jquery 的类或背景属性,这可能吗?

jquery - IE7 & 验证 : Why doesn't this work?

html - 自动完成属性不起作用

javascript - 通过 Ext.data.connection Sencha Touch 和 Phonegap 在互联网可用时加载谷歌地图 API

c++ - 使用 C/C++ 自动化 Internet Explorer

html - 页脚背景图像位置问题仅适用于 IE7!

css - Twitter Bootstrap - Internet Explorer 中的导航栏问题

php - 找不到用户名和密码-php

android - Azure 媒体服务 - 视频无法在 Android 手机上通过浏览播放