Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS & Pring/Screen 1

Status
Not open for further replies.

webmigit

Programmer
Aug 3, 2001
2,027
US
Help! Again, please.

With the code below I'm trying to make a graphic that appears on print but not on screen... Is there anyway to do this?

Code:
<style type="text/css" media="screen">
  <!--
    .ibg {background: none}
  -->
</style>

<style type="text/css" media="print">
  <!--
    .ibg {background: url(...image...) no-repeat center right}
  -->
</style>

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
That appears fine. Your problem is most likely in your browser settings. Background images, by default, do not print. Make sure you change your settings.

In IE: Tools > Internet Options > Advanced

Make sure "Print Background Color and Images" is checked.

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
See my faq on printing backgrounds:
Otherwise, you can do it differently:
Code:
<style type="text/css" media="screen">
  <!--
    .ibg { display: none; }
  -->
</style>

<style type="text/css" media="print">
  <!--
    .ibg { display: inline; }
  -->
</style>

<img class="ibg" src="mypic.jpg" alt="mypic" />
With this, you will have an img on the page, which is not displayed on screen but it is on the printout.
 
That's a good point, I forgot about that... I'll have to start from scratch on this one I don't have anywhere on a tightly constructed table that this will fit... as a big, I have a few places that it goes over by a few pixels. but its so light, its ok..

Hmm... Thanks again, you're 2 for 2.

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top