Hiding parts of html page on printing

If you need to create a web page on which some parts should not be visible when it is printed (or even print-previewed) you can use the following CSS:

@media print
{

.notPrint
{

display:none;

}

}

Then in the html you can specify something like this:

<div class=’notPrint’>This is not visible in printing</div>

This is useful if you have things like buttons and other stuff that is not applicable when printing.

  1. That’s great! I wanted to hide the sidebar but I didn’t know how, Thank you 😀

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>