Printing CSS Background Images
In ASP.NET Sprites, it's possible to encounter difficulties with printing background images. Despite the HTML displaying the images, they may vanish when printing due to browser limitations.
Code Generated:
<code class="html"><a href="/" id="siteLogo"><img class="getmecooking-logo-png" src="data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" /></a></code>
Print Stylesheet Modifications:
Override the visibility property of the siteLogo element in your print.css like this:
<code class="css">#siteLogo { visibility: visible !important; }</code>
Browser-Specific Considerations:
For Chrome and Safari, add the following to your CSS:
<code class="css">@media print { * { -webkit-print-color-adjust: exact; } }</code>
Unfortunately, in other browsers like IE 9, 10, and 11, users must manually select the option to print background images. They can do this by clicking the cog icon in the print dialog, navigating to Page Setup, and enabling that option.
The above is the detailed content of Why Are My Background Images Not Printing in ASP.NET Sprites?. For more information, please follow other related articles on the PHP Chinese website!