这是我现在的流程:

  1. 将更改保存到print.css
  2. 打开浏览器并刷新页面.
  3. Right-click and choose Print > Print Preview (Firefox, but any browser really)

这是第三步困扰着我,我想知道是否有可能用一个插件或什么东西把它从这个过程中go 掉.只需 Select 将页面作为打印介质查看,然后只需刷新即可查看更改.

如何测试打印样式表?您总是在刷新后单击打印预览吗?

推荐答案

您可以使用邮寄See print css in the browser中接受的ChromeMedia Type Emulation.

UPDATE 21/11/2017

更新的DevTools文档可以在这里找到:100.

在打印模式下查看页面:


UPDATE 29/02/2016

DevTools文档已移动,上述链接提供的信息不准确.有关媒体类型仿真的更新文档可在此处找到:Preview styles for more media types.

Open the DevTools emulation drawer by clicking the More overrides ••• more overrides icon in the top right corner of the browser viewport. Then, select Media in the emulation drawer.

UPDATE 12/04/2016

不幸的是,文档似乎没有在打印仿真方面进行更新.但是,Print Media Emulator已(再次)移动:

  1. 打开Chrome DevTools
  2. 在键盘上按esc键
  3. 单击(垂直省略号)
  4. Select Rendering
  5. 勾选Emulate print media

请参见下面的屏幕截图:

rendering settings 12/04/2016

UPDATE 28/06/2016

Google Developers Docs around Chrome DevTools and the "Emulate Media" option have been updated for Chrome >51:

https://developers.google.com/web/tools/chrome-devtools/settings?hl=en#emulate-print-media

To view a page in print preview mode, open the DevTools main menu, select More Tools > Rendering Settings, and then enable the emulate media checkbox with the dropdown menu set to print.

rendering settings 28/06/2016

UPDATE 24/05/2016

设置的命名再次更改:

To view a page in print preview mode, open the DevTools main menu, select More Tools > Rendering, and then enable the Emulate CSS Media checkbox with the dropdown menu set to print.

emulate CSS media

Css相关问答推荐

与Chrome和Edge相比,背景位置动画在Firefox中运行并不流畅

为什么图像加载请求没有显示在我的网络请求中?

将照片向下对齐至div并保持响应性

不了解重复-线性-渐变 colored颜色 停止

靴子,为什么我不能让任何东西正确地排好队?

我找不出Firefox上奇怪的css行为的原因

导航栏没有使用nextui获取页面的全部宽度

当滚动量较小时,在滚动问题上动画粘性导航

使用文本溢出约束内部 div:没有最大宽度的省略号(或类似的)

使用CSS Grid是否可以跳过下一列?

我可以拆分我的 CSS / SASS webpack 加载器规则,还是它们需要成为一个大规则?

带有 flex 的 CSS 空 div 以扩展并保持纵横比

Tailwind css break-word 在输入字段中不起作用

使用任意运行时字符串进行 Tailwind CSS 类定位

在 WooCommerce 变体 Select 中转换属性文本以大写

热门制作渐变半红/半蓝?

css中的背景图像没有被缓存

位置元素垂直固定,绝对水平

溢出的文本可以居中吗?

了解 Bootstrap 3 中的网格类( col-sm-# 和 col-lg-# )