How can I print background images in FF or IE?

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;
}

or even easier:

<div class="star"><img src="https://stackoverflow.com/questions/596876/./images/star.jpg" alt="*" /></div>

/* media:screen */
.star img {
    visibility: hidden;
}

/* media:print */
.star img {
    visibility: visible;
}

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="https://stackoverflow.com/questions/596876/main.css" media="screen" />
<link rel="print stylesheet" type="text/css" href="print.css" media="print" />

Leave a Comment