打印css样式未显示 [英] print css style not shown

查看:887
本文介绍了打印css样式未显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为media = print创建了一个样式,如下所示:

I have created a style for media= print like this:

#content .inner h2 {
background:Red;
border-bottom:solid 1px #dfdfdf;
color:#000000;
font-size:20px;
padding-left:10px;
}

但是当我打印预览时,红色不显示。如果我设置media =屏幕,并使用这个样式表。然后显示红色。

But red color is not shown when i print preview. If i set the media=screen and use this stylesheet. then red color is shown. any hint for this?

推荐答案

取决于您使用的浏览器,但我怀疑MSIE?

Depends which browser you are using, but I suspect MSIE?

默认情况下,许多浏览器会选择在进入打印模式时不显示页面的背景颜色(打印首选项对话框中通常有一个设置/选项可以更改此设置)。

By default, many browsers will choose not to render the background color for a page when going to print mode (there is usually a setting / option in the print preferences dialog to change this).

另一件需要考虑的事情 - 当你引用样式表时,你可以:

Another thing to consider - when you are referencing the style sheet it is possible you either:


  • 未正确指定媒体类型,因此未正确载入媒体类型

  • 浏览器有错误行为,并且无法加载样式

  • 您的打印样式正被另一个样式覆盖

有许多工具可以免费使用,可以帮助您识别应用的样式页面上的任何给定元素。如果您使用FireFox,请查看网络开发者扩展(也可以在Google Chrome浏览器中在作者网站上使用)。如果您使用MSIE或其他浏览器,您可能会得到一个名为Aardvark的书籍标记脚本工作(没有链接,因为上次我检查的主要网站被列为有恶意软件 - 仔细浏览)。

There are lots of tools freely available which can help you to identify the styles being applied to any given element on a page. If you use FireFox, check out the Web Developer extension (also available for Google Chrome on the authors site). If you use MSIE or other browsers, you might be able to get a book marklet script called Aardvark to work (no link because last time I checked the main site was listed as having malware - browse with care).

这篇关于打印css样式未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆