如何在FF或IE中打印背景图片? [英] How can I print background images in FF or IE?
问题描述
有没有办法设置ff和ie打印背景图像?
Is there any way to set ff and ie to print background images?
我使用星星图像来分类一些技能,我将其设置为背景图像和定位,要么设置一个开始,两个,三个等等。当我尝试打印页面图像消失。
I am using stars image to classify some skills and I set it as a background image and positioning to either set one start, two, three, etc. When I try to print the page the images disappear.
因此,有什么办法让它们在我打印页面时出现,或至少有一种方法用*或某些可见的图像替换图像。
So is there any way to make them appear when I print the page or at least have a way of replacing the images with * or something that would be visible?
推荐答案
您是否考虑过使用打印样式表?这可以允许您执行以下操作:
Have you considered using a print stylesheet? This could allow you to do something like:
<div class="star">*</div>
/* media:screen */
.star {
background: ...;
overflow: hidden;
text-indent: 9999em;
}
/* media:print */
.star {
text-indent: 0;
}
或更简单:
<div class="star"><img src="./images/star.jpg" alt="*" /></div>
/* media:screen */
.star img {
visibility: hidden;
}
/* media:print */
.star img {
visibility: visible;
}
您可以通过css提供媒体标记来指定浏览器应该使用的样式表或链接元素上:
You can specify stylesheets browsers should use by supplying a media tag, either by css or on the link element:
<link rel="stylesheet" type="text/css" href="main.css" media="screen" />
<link rel="print stylesheet" type="text/css" href="print.css" media="print" />
这篇关于如何在FF或IE中打印背景图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!