Forum Moderators: not2easy

Message Too Old, No Replies

Question on printing.

need an advise

         

Mekazama

5:54 am on Mar 12, 2007 (gmt 0)

10+ Year Member



It is possible to print only the elements that are being put within a <div>...</div>.. actually I already wrote a simple code to hide a certain section on the page to be hidden when printed but it looks like there is other code that overwrite it and it will appear when I print it. The code run well on some of my forms but other it won't work and I expect it has been overwritten..i guess..

So, I'm just thinking to print only the things that I want instead of hiding some parts..ehehe.. any advice..?

my code to hide when print:

<style type="text/css" media="print">
.no_print{
display:none;
}
</style>

sunsterv

4:30 pm on Mar 12, 2007 (gmt 0)

10+ Year Member



Hi, I use this all the time. Generally speaking I create a css file called screen.css for the screen work, duplicate it and call it print.css and then make the changes to the css. This is done as two separate css files that the html page links to. So...

in the html code I have...(placed in the <head> location </head>

<link href="css/print.css" rel="stylesheet" type="text/css" media="print" /><link href="css/screen.css" rel="stylesheet" type="text/css" media="screen" />

if I remember rightly, having the print stylesheet before the screen stylesheet works.

then, taking an example div...

the screen is

#toplinks {
background-color: #FFFFFF;
margin: 0px;
}

and the corresponding print style is...

#toplinks {
background-color: #FFFFFF;
margin: 0px;
display: none;
}

the difference I can see with your code is that there is no space between display:none; when it should be display: none;

hope that works. I'm quite new to this too, but it did the trick for me!

Old_Honky

11:58 am on Mar 20, 2007 (gmt 0)

10+ Year Member Top Contributors Of The Month



Wouldn't

#toplinks {display: none;}

Do the trick in your print style sheet? Surely you don't need to list all the stuff that is not going to be printed.