2

I have a page with a top navigation area, a side navigation area, a control button area and somewhere in the middle a DIV with an id="content" that contains content.

I would like to be able to print just the contents of that DIV. I realize I have many lines of code making my other areas invisible and resizing everything but is there some alternative? Is there some way I can just print the contents of the DIV?

thecodeparadox
  • 86,271
  • 21
  • 138
  • 164
Alan2
  • 23,493
  • 79
  • 256
  • 450

2 Answers2

4

Take a look at using Media Types - specifically @media print - in your CSS to specify styling that only applies to printing.

This way, you can write a stylesheet that hides everything except your "area inside a DIV".

Widor
  • 13,003
  • 7
  • 42
  • 64
1

Use a css print stylesheet putting display:none in the fields that you don't want to print. Use the tag link like this:

link rel="stylesheet" type="text/css" media="print" href="print.css"

OR @media print {

BODY { font-size: 10pt }

}

FabioCosta
  • 3,069
  • 6
  • 28
  • 50