Print only a portion of a web page

One approach is to use CSS (in this example we will assume you have a separate CSS file).

This code comes from:

We have used it and it works.

In your CSS file add the following lines:

/* Print. */

@media print {

/* cssclsNoPrint class. */

.cssclsNoPrint {display:none}


/* Screen. */

@media screen {

/* cssclsNoScreen class. */

.cssclsNoScreen {display:none}


Our CSS file in this example is called "style.css".

In each webpage where you want to limit the printing reference the css file in the head part of your html file:

<link rel="stylesheet" type="text/css" href="style.css">

Then put this code in each section you don't want to print:

<span class="cssclsNoPrint">


Any text inside this span will not print. You can have a lot of content inside this span.