CSS Printing

CSS printing is the process of setting up a print style sheet. The best method is to start from scratch and rely on the default style sheet of the browser, which takes care of the printed output pretty well by default. In this case, insert all declarations for printing at the end of your main style sheet, and enclose them with this distinct rule:

@media print { 
 /* All your print styles go here */
 #header, #footer, #nav { display: none !important; } 

CSS Printing -browser suport

The @media print is supported in the following browsers:

  • FireFox 3.5
  • Internet Explorer 9
  • Chrome 14
  • Safari 3.2
  • Opera 11

@media print-link

If you are defining your style sheet in a separate file, then you can also use the media attribute when linking to an external style sheet

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