How do you debug printable CSS?

前端 未结 10 1958
耶瑟儿~
耶瑟儿~ 2020-12-02 18:09

I use Firebug and IE Developer Toolbar all the time to debug tricky CSS problems. But occasionally, a tricky bug comes up that only appears when you go to print the page.

相关标签:
10条回答
  • 2020-12-02 18:27

    I use the WebDeveloper plugin and the CSS --> Display CSS by Media Type --> Print to view the CSS as it would when printed. Firebug's inspection utilities work with the CSS as filtered by the plugin.

    0 讨论(0)
  • 2020-12-02 18:28

    In Chrome 51:

    Open devtools (CTRL + F12 or CTRL + SHIFT + I) and click on the ... menu, click More Tools > Rendering settings to open the Rendering tab of the developer console (alternatively, if the console is open just navigate to this tab).

    In that tab, select and check the box for Emulate Media: print.

    0 讨论(0)
  • 2020-12-02 18:28

    In chrome developer tools (F12 \ Ctrl(cmd on mac) + Shift + C): In the emulation tab (From Chrome 32 onward IMHO), there is a tab for 'Media'.

    There you can check the media emulation checkbox and select the media you would like to emulate ('print', 'screen' etc.)

    0 讨论(0)
  • 2020-12-02 18:32

    In Firefox 69, I found a button to simulate print media. Just open the Developer Tools (F12) and click on Inspector. The toggle button is the leftmost icon that's in the highlighted section in the screenshot below, the one that looks like a sheet of paper.

    0 讨论(0)
  • 2020-12-02 18:38

    How about just listing your print CSS last, and removing the "print" condition from your CSS link or import statement? Then you're debugging the print CSS in the browser window.

    0 讨论(0)
  • 2020-12-02 18:38

    I use the Adobe PDF virtual printer, because it's the closest thing to a real printer you'd get, without wasting ink and paper.

    Anyway, it's recommended to have a separate CSS for prints, with much simpler graphics and less of the images you use just for design purposes.

    0 讨论(0)
提交回复
热议问题