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
  • 84,459
  • 21
  • 136
  • 161
Alan2
  • 21,590
  • 73
  • 223
  • 402

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
  • 12,605
  • 6
  • 38
  • 62
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
  • 2,934
  • 4
  • 26
  • 49