在浏览器中查看打印 css

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16105147/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 22:32:32  来源:igfitidea点击:

See print css in the browser

css

提问by Simon Dragsb?k

I wanted find out how i could inspect my print css just like when i inspect my elements with the normal css and i looked all over for plugins and such stuff

我想知道如何检查我的打印 css,就像我用普通的 css 检查我的元素一样,我到处寻找插件和类似的东西

Like when you preview a print in chrome but where your able to inspect the elements

就像您在 chrome 中预览打印但可以检查元素时一样

enter image description here

在此处输入图片说明

@media print {
   p{color:red;}
   ..... my css
}
.sharebar {
    position: absolute;
    right: 0;
    top: 0;
    z-index: 195;
    font-size: 12px;
    font-family: 'Open Sans', sans-serif;
    font-weight: 400;
    text-transform: uppercase;
}

回答by andyb

Chrome has this functionality out of the box in the DevTools- see CSS Media Type Emulation.

Chrome 在DevTools中具有此功能,请参阅CSS Media Type Emulation

回答by Mike

Do this in chrome:

在 chrome 中执行此操作:

  1. Open the Developer Tools
  2. Click the "Customize and control DevTools" hamburger menu button.
  3. Choose More tools > Rendering settings.
  4. Check the "Emulate CSS Media" checkbox at the Rendering tab and select the Print media type.
  1. 打开开发者工具
  2. 单击“自定义和控制 DevTools”汉堡菜单按钮。
  3. 选择更多工具 > 渲染设置。
  4. 选中渲染选项卡上的“模拟 CSS 媒体”复选框,然后选择打印媒体类型。

Very detailed steps can be found here.

可以在此处找到非常详细的步骤。

回答by sevenseacat

If you're using Firefox, you can use the Web Developer Toolbar for this (and many other good things!)

如果您使用 Firefox,您可以使用 Web Developer Toolbar(以及许多其他好东西!)

http://chrispederick.com/work/web-developer/

http://chrispederick.com/work/web-developer/

After installing the toolbar, the option can be found under CSS -> Display Styles By Media Type -> Display Print Styles.

安装工具栏后,可以在 CSS -> Display Styles By Media Type -> Display Print Styles 下找到该选项。