Home >Web Front-end >CSS Tutorial >How to Print Background Images Generated by ASP.NET Sprites in Different Browsers?

How to Print Background Images Generated by ASP.NET Sprites in Different Browsers?

Patricia Arquette
Patricia ArquetteOriginal
2024-10-26 10:23:021083browse

How to Print Background Images Generated by ASP.NET Sprites in Different Browsers?

Printing Background Images with CSS

Problem:

ASP Net Sprites generated CSS Sprites are not printing. The generated HTML code includes tags with base64 encoded data, rendering the images invisible at print.

Solution:

For Chrome and Safari:

<code class="css">@media print {
    * {-webkit-print-color-adjust:exact;}
}</code>

This CSS rule forces Chrome and Safari to print background images as intended, regardless of their source.

For Other Web Browsers:

Unfortunately, for other web browsers, users must manually enable background image printing. For example, in IE 9, 10, and 11, users must:

  1. Click the cog icon (Print Settings)
  2. Select "Print"
  3. Click "Page Setup" and activate the option to "Print Background Colors and Images"

The above is the detailed content of How to Print Background Images Generated by ASP.NET Sprites in Different Browsers?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn