如何使用css获取要打印的背景图像? [英] How to get a background image to print using css?

查看:29
本文介绍了如何使用css获取要打印的背景图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 ASP Net Sprites 包 在我的网站上创建 CSS Sprite.

I am using the ASP Net Sprites package to create CSS Sprites on my website.

它正在工作,但它生成的图像在打印时不显示.

It is working, but the images it generates do not appear when printed.

在 HTML 级别生成的代码是:

The code generated at HTML level is:

<a href="/" id="siteLogo"><img class="getmecooking-logo-png" src="data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" /></a>

如何在用户打印页面时显示徽标图像?

How can I get the logo image to appear when a user prints the page?

我曾尝试在我的 print.css 样式表中添加它,但没有奏效:

I have tried adding this in my print.css stylesheet, but it didn't work:

#siteLogo
{
    visibility: visible;
}

print.css 工作正常,并且按照我希望的方式为页面上的其他元素设置页面格式.我唯一的问题是网站徽标图像在打印时无法显示.

The print.css is working fine and it is formatting the page as I want it to for other elements on the page. My only issue is that I can't get the site logo image to display when it is printed.

推荐答案

打印或不打印背景图像取决于用户及其浏览器设置.为了避免依赖它,请使用实际的 <img/> 标签将图像直接放入 HTML 中.

It's up to the user and their browser settings to print or not print background images. To keep yourself from relying on that, put the images directly in the HTML with an actual <img /> tag.

这篇关于如何使用css获取要打印的背景图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆