【问题标题】:Why does the media attribute in the link element does not work for the print value? [duplicate]为什么链接元素中的媒体属性对打印值不起作用? [复制]
【发布时间】:2014-04-06 10:22:46
【问题描述】:

这是 HTML:

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>HTML</title>
        <link rel="stylesheet" type="text/css" href="screen.css" media="screen">
        <link rel="stylesheet" type="text/css" href="print.css" media="print">
    </head>
    <body>
        <!-- Add your content here-->
    </body>
</html>

这里是screen.css:

body {
    background-color: cyan;
}

这里是 print.css:

body {
    background-color: red;
}

屏幕看起来不错,应有的方式,青色背景颜色。但是,打印预览显示白色背景色。有人知道为什么会这样吗?

【问题讨论】:

    标签: html css


    【解决方案1】:

    您需要在浏览器的打印设置中选择“应用背景颜色和图像”选项。

    以下链接可能会有所帮助。css media type print using background-color in chrome

    【讨论】:

      猜你喜欢
      • 2013-06-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-16
      • 2016-07-30
      相关资源
      最近更新 更多