在撰写本文时,此功能仅适用于Chrome 18+,但由于已标准化,因此最终将遍及所有地方。
@media print {
body {
/* IE4-8 and 9 (deprecated). */
filter: Gray();
/* SVG version for IE10, Chrome 17, FF3.5,
Safari 5.2 and Opera 11.6 */
filter: url('#grayscale');
/* CSS3 filter, at the moment Webkit only. Prefix it for
future implementations */
-webkit-filter: grayscale(100%);
filter: grayscale(100%); /* future-proof */
}
}
翻译自: https://css-tricks.com/snippets/css/forcing-grayscale-printing/