Picto thématique

Rule n° 190 - The site offers styles dedicated to printing.

It is perfectly possible to predict how the web content of a page should be printed on paper. Style sheets for print media are there for that.

#Presentation #Development

Goal

  • Allow content to be printed in a form that is appropriate to the medium.

Implementation

Provide a specific style sheet for the media type print, for example in the form: link rel="stylesheet" type="text/css" href="print.css" media="print" />.

Printing styles can correct a global style sheet (style sheet for all media or without mention of the media) or apply only for media print if the display style sheet is called by specifying the media print.

Find out more:

Control

This best practice can be quickly evaluated by testing the print preview in the browser, but confirmation needs the code to be inspected to find if a print style is present for the media print, which can be:

  • In the form of a tag of type <link rel="stylesheet" type="text/css" media="print" href="print.css" /> ;
  • In the form of a tag of type <style media="print" type="text/css">…</style> ;
  • In the form of a rule @media print {…} in an internal or external CSS;
  • Or in the form of a rule @import url("print.css") print; in an internal or external CSS.

By Opquast - Read the license