html - 打印页面中的 div 背景颜色不起作用

标签 html css background-color print-preview

我想使用 div有一个 background-color ,但如果我打印页面,它会显示为白色。

当我使用 <tr bgcolor="#333333"> 创建表时它也不起作用。

如何使用 css 创建打印页面和 html

我的代码:

<table border="0px" cellspacing="1" cellpadding="0" bgcolor="#777777" width="650px">
   <tr bgcolor="#999999">
       <td align=right colspan=2><span style="font:bold 14px 'b nazanin';">Text</span></td>
   </tr>
</table>

最佳答案

CSS: box-shadow: inset 0 0 0 1000px gold;

适用于所有浏览器以及表格单元格和行。

关于html - 打印页面中的 div 背景颜色不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6553439/

相关文章:

html - 网络安全颜色怎么样

如果没有设置背景颜色,Android获取父 View 的背景颜色

javascript - 创建点击进入实际 map 的 map 示例

Javascript iframe 速度问题

css - 空样式 (.css/.scss) 文件

css - 在 SASS 中通过引用传递函数或 mixin

javascript - HTML 表格更改单元格颜色

jquery - 为什么 $(this).animate 不起作用

javascript - 删除和设置元素的文本

html - 为什么嵌入视频不是通过 z-index?