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

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

问题描述

我使用 ASP Net Sprites软件包在我的网站上创建CSS Sprites。

$



HTML级别生成的代码是:

p>

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

如何在用户打印页面时显示标志图片?



我试过在我的print.css样式表中添加这个,但是没有工作:

  #siteLogo 
{
visibility:visible;
}

print.css工作正常,它正在按我想要的格式化页面它为页面上的其他元素。我唯一的问题是,在打印网站标志图片时无法显示。

解决方案

用户及其浏览器设置以打印或不打印背景图像。为了避免依赖于这一点,将图像直接放在HTML中,并使用实际的< img /> 标记。


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.

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?

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

#siteLogo
{
    visibility: visible;
}

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.

解决方案

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天全站免登陆