Free Webmasters Resource
 

Free Graphics, Tutorials, Scripts, Webmaster Forums, Web Templates, SEO Tools, & Much More!!

Home Scripts Tutorials Free Downloads Articles SEO Play Free Games Web Templates

Hide from Print

Have you ever wished you could hide a portion of HTML from being printed when a visitor prints a web page? Well, believe it or not, it's a simple feat to accomplish, and it will leave observant viewers thoroughly astounded by your greatness.

Hiding objects from print is something we like to do on Spoono on certain pages like this one. We hide undesirable objects like ads and the back button below from printing. (Go to Print Preview to see for yourself). This trick can be accomplished by creating a print-only style that has a hidden visibility and applying it to certain objects. The most efficient way to do this is by linking to an external CSS document like so:

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


Note that the media attribute is set to the value "print." This tells browsers to only use the classes in this file when printing. If you also have a regular CSS file that loads styles for regular screen display, you can leave the code for that untouched. Now, the following is the code that needs to go into your hide.css file (or whatever you've named it):

.hide {
display: none;
}


That was certainly simple enough. The last step is to define the hide class for the content that you want to hide. To do this, you can add a class attribute to any of the following tags: <div> <p> <span> <td> plus many others. So here is an example for the code of hidden content:

<div class="hide">
THIS CONTENT IS HIDDEN
</div>


That's it. Now don't you feel sneaky?

 

Tutorials: HTML

Title/Description

Level

Backgrounds: Tutorial
Learn how to effectively add backgrounds to your page that make your page look professional or amateur.

Beginner

Imagemaps: Tutorial
Make one image into various clickable regions using only HTML

Intermediate

Embedding Fonts: Tutorial
Learn how to use uncommon fonts in web pages by embedding them.

Advanced

Images: Tutorial
Positioning images can make your images look just right when inserted into text.

Intermediate

Form Effects: Tutorial
Learn how to create trendy forms with simple style commands as well as with CSS classes.

Intermediate

Layers: Tutorial
Layers can make complicated image placement possible.

Advanced

Forms: Tutorial
Use forms to gather information from your users.

Advanced

Links: Tutorial
Making links in HTML is the easiest thing you will ever do.

Beginner

Frames: Tutorial
Learn how to create frames that enable you to create navigation systems on your site.

Advanced

Scrollbars: Tutorial
Learn how to add effects to your scrollbars and add flavor to your page.

Advanced

Hide From Print: Tutorial
Learn how to only allow a visitor to print part of your page using CSS.

Intermediate

SSI: Tutorial
Learning how to do SSI will save you a lot of authoring time.

Advanced

Horizontal Line: Tutorial
The horizontal line serves as a great separator tool.

Beginner

Table Styles: Tutorial
Learn how to add various table styles such as dash or dot borders, and many other things.

Intermediate

Iframes: Tutorial
Iframes can organize your website into clean sections.

Advanced

Tables: Tutorial
Organize your web page layouts with tables.

Intermediate

216 Web Safe Color Chart: Tutorial
The 216-color color-safe palette refers to colors (RGB values) that will appear the same on either IE or Netscape and Windows or Mac platforms.

Beginner

Pantone RGB/Hex/HTML Colors: Tutorial
This table contains all pantone colors converted to RGB and Hex. It displays them all in HTML colors.

Intermediate

 


Home Contact Credits Flash Templates Webmaster Forums Site Map Webmaster Resources Advertise


Computer Playground
· Templates Resource