Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force browser to render webpage's Print stylesheet

Tags:

html

browser

css

A lot of web pages use a Print stylesheet to format things better for printing. My question is, is it possible to force the browser to render a page using the print stylesheet without actually printing it?

like image 984
Matt Overall Avatar asked Oct 21 '11 20:10

Matt Overall


2 Answers

In Chrome (version 78), you can force the browser to render the webpage's print stylesheet using Chrome DevTools by going to More Tools > Rendering

Open Chrome DevTools Rendering Settings

then selecting the Print option in the Emulate CSS Media dropdown

Emulate print media checkbox in Chrome DevTools

like image 97
Sal Ferrarello Avatar answered Nov 04 '22 18:11

Sal Ferrarello


usually the print css has a media type of print. simply remove the media definition and use it in replace of the main style sheet

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

change to

<link rel="stylesheet" type="text/css" media="all" href="print.css" />
like image 31
Eonasdan Avatar answered Nov 04 '22 16:11

Eonasdan