How do i add the style where when people print the page, i can change the background color and font and stuff. how do id add that to an external css?

3 answers

This was chosen as the best answer

It's pretty simple, just add this somewhere in your head tags...

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

where print.css is your external stylesheet containing styles solely for the printed version.

Answered about 10 years ago by Stuart Memo

If you want to save making an extra HTTP request, just add this block to the bottom of your normal css stylesheet:

 @media print {

    /* Rules for print here */

Answered about 10 years ago by Shaun Robinson

You can also add the following line into your master css file;

@import "print.css";

And in your print.css, open the document with

@media print { 

This keeps your print.css separate to your main css rules, and the file itself.

Answered about 10 years ago by Russell Bishop