Help! "No Print" Print Button Code??

User 385190 Photo


Registered User
14 posts

Can't anyone out there help with this?
I need to print a page but don't want the print button on the page to print with it.........how do I make this happen. This is my 2nd post......several views but no help on my 1st post.......someone must know how to do this. I host with Lunarpages and don't know much at all about css.

Thanks in advance for any help.
User 364143 Photo


Guest
5,410 posts

You will have to have a css for normal viewing and a print css for printing. In the print css, you will put items in a div that have the display set to none.

Google print css and you will get a lot of nice tutorials on the subjected.
CoffeeCup... Yeah, they are the best!
User 37670 Photo


Registered User
2,138 posts

The only way I know how to hide anything from the printer is with .css
I'm afraid there is little to find (back when I was looking for it) on the net on this topic that is not complicated or a long process, so I made my own simple code to handle it.
The .css file is simply this:

body {visibility:visible;}
.print {visibility:hidden;}


And I save that (and only that on the page) as print.css

Next, you use some code to let your page know that you are using that .css file. Put this in between the <head> </head> tags on your web page.
<link rel="stylesheet" href="print.css"
type="text/css" media="print" />


The last part is to call the code into play, around whatever you want not to print. The print button code could look like this:

<div align="center" class="print"><form><input type="button" value=" Print this page "
onclick="window.print();return false;" /></form> </div>


You could also have sections of the page that do not print by using the same technique:
<div class="print">This text will not print on the page, as long as you are using the print.css file</div>

Let me know if this works for you. I have been using it for at least 3 years with no trouble.
E-Learning Specialist
www.mainsites.ca is my website, and yes, some of it is crappy.

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.