This is not entirely in control of the web page author.
For example, this fiddle will print (at least it did for me on a Dell 1720 Laser Printer) white text on any of the three black backgrounds in
IE9
if the user has checked the box found next to:
Tools -> Print -> Page Setup -> "Print Background Colors and Images"
If that box is unchecked, then it will not print the black at all on the first two, but will on the last (since it is an img
tag), but it prints the text as a grey, even over the img
tag. Thus, it seems that the setting for "Print Background Colors and Images" affects how the browser interprets the text, and will allow a true white (knock-out effect) if checked, but not if unchecked.
Firefox
Checkbox found here (which seems to work):
File -> Page Setup -> "Print Background (colors & images)"
For Chrome? Web Page Author Controlled?
I have not yet verified whether the information from this post will do it or not (it does not work for me on my next fiddle, but it may be because it is in an iframe). For elements that should print in Chrome, try setting:
-webkit-print-color-adjust: exact;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…