Css style sheet print

following an online course on webdesign, i have a problem with css “print”.
They are looking for best practice. Do i have to use :

href="feuille_impression_print.css" media="print">and < media="screen"> 

or can i just use:


If I use “text/css”, it is much easier to layout the print document.
Basically the problem occurs with the “flexbox” and the “table” which don t show up when I use “screen”
"display=“none” and "display=“block” and "visibility=“hidden” don t work and I don t think they don t want @media print to be used.
How do I make the “table” and “flexbox” visible ?
This is my first post on the forum, happy to join.
Christian Morris.

If you only want the rules to apply to printed media then use media=“print”.

Usually its easier to do a global stylesheet for all media and then just over-ride for print media using a print stylesheet.

When checking the print stylesheet you can omit the media = print to start with so you can see the changes on the screen but once happy add the media=print back in place and check on the print preview output to make sure.

The print stylesheet should be the last stylesheet in order.

Here is a screenshot of the three screens.

You appear to have the print sheet before the screen one.
Also you specify “screen” for the screen sheet. It’s probably best not to do that, but have it as a default style sheet for all media, then override what you need to in the print sheet after it.
Which is pretty much what Paul said above.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.