search engine optimization articles do it yourself seo hiring search engine experts html and search engine optimization web site analysis and submission service

HTML Help: Prevent Printing

Is there a way to keep people from printing out my web pages?
Yes, and no. A determined user with some computer and HTML savvy can always find a way to print your page, but you can use CSS to stop the average user and make it more difficult for the rest.

Just add this:

<style type="text/css" media="print">
body {visibility: hidden; display: none;}
</style>
...to the HEAD section of your web page. In the first line of the code you can see that media="print" is the property the style effects. By setting the visibility to hidden and the display to none for print media in the body of the document, your page won't print, but it will display on the screen.

In some browsers nothing will happen when someone tries to print the page. In others, it will run a piece of paper through the printer. In still others it may print the date, web address, and/or page number(s) according to how many pages would print if printing wasn't disabled.

There are other ways to prevent printing, but this is the easiest and works well in most browsers.

This concludes the

HTML Help about Preventing Web Page Printing

.
Back | HTML FAQ | HTML Tag Chart | HTML Index | Web Design Tutorials
search engine optimization course
If you want your web site to rank high in the search engines . . . what are you going to do to get it there? Check out my search engine optmization guide, SEO for YOU: Search Engine Optimization for Ordinary Everyday People!

Check out SEO for YOU now!

Almost a Newsletter

Subscribe today for exclusive website design tutorials and grab some free gifts to boot! Learn more, or subcribe below:
Email:

First Name:

Privacy Policy

Did you know...

The member's site has about 100 standards compliant HTML and CSS tutorials, 31 handy reference charts, reprintable content, web graphics, exclusive fonts, free software, free ebooks and more? All this for less than 9 cents a day! [ Details ]
See my fancy bottom! :)