cssprintingprint-style

Printer Stylesheet in Head


I have a print stylesheet setup but I need to override a few properties of the stylesheet on one page. The easiest way I could figure to do this is to just put the styles needed in the head of the page like this:

<style type="text/css">
  /* Print Styles */
</style>

But my problem is I do not know how to target just the printer.

Note: I do not want to create another stylesheet.


Solution

  • @media print {
       .someclass {
            color: red; /*makes it red only when printing*/
       }
       /*more printer-only styles*/
    }
    

    For reference about other media types: little link.