打印HTML忽略CSS样式表 [英] Printing html ignores CSS stylesheets

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

问题描述

我有一个非常简单的带有表格元素的html页面。

文档使用css样式。当我打印页面时,看起来好像根本没有样式表。错误的字体,一切都是错误的。



这里有什么问题?我是否必须为打印创建特殊的CSS?在我的情况下,它会是相同的..是真的有必要吗?

解决方案

没有链接到页面,我只能提供小建议。




  • 确保标题中样式表
    的链接是正确的。它应该看起来像这样:



    < link rel =stylesheettype =text / csshref =/ link / to / .cssmedia =all>




我刚注意到你提到打印全部媒体类型可以在网络和打印中使用。然而,如果你想为 print 显式声明另一个样式表,而不是用 print替换 all




  • 检查样式是否被
    重写。作为CSS 级联样式表

  • 获取Firebug。


I have a very simple html page with a table element.

The document is styled with css. When I print the page it looks like there are no stylesheets at all. Wrong font, everything is wrong.

What's the problem here? Do I have to create a special css only for printing? In my case it would be the same.. Is that really necessary?

解决方案

Without the link to the page, I can only offer little advice.

  • Make sure the link to the stylesheet in the header is correct. And it should look something like this:

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

I just noticed that you mentioned print. The all media type will work across web and print. However, if you wanted to explicitly state another stylesheet for print than replace the all with print.

  • Check to see if the style are not being overridden by something else. As CSS is Cascading Style Sheets
  • Get Firebug.

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

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