我有一个html页面,其中有一个表格,并且在显示时打印的标题不相同
绿色div标签和表格页脚文本只是打印没有背景
请帮帮我
我的代码是
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<style type="text/css">
.cnt
{
padding-top:10px;
padding-bottom:10px;
}
</style>
</head>
<body>
<div style="width:21cm; margin-left:auto; margin-right:auto; padding-top:0px; position:relative;">
<div style="width:90%; margin-left:auto; margin-right:auto;">
<div style="color:#FFF; background-color:green; padding:5px; font:20px bolder Verdana, Geneva, sans-serif; text-align:center;">
Receipt Details
</div>
<div>
<table border="1" cellspacing="2" cellpadding="2" width="100%">
<tbody><tr bgcolor="#000" style="color:#FFF; text-align:center;">
<td>
Receipt No.
</td>
<td>
Date
</td>
<td>
Amount Paid
</td>
<td>
Amount Due
</td>
<td>
Remark
</td>
</tr>
<tr style="text-align:center;">
<td>
</td>
<td>
</td>
<td>
500/-
</td>
<td>
</td>
<td>
Registration
</td>
</tr>
<tr style="text-align:center;">
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
Fee Payment
</td>
</tr>
<tr style="text-align:center;">
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
Fee Payment
</td>
</tr>
<tr style="text-align:center;">
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
Fee Payment
</td>
</tr>
</tbody></table>
</div>
</div>
</div>
</body></html>
答案 0 :(得分:2)
<link href="/automin/90617406afeb35403b4c010c2cdd4071.css" type="text/css" title="default" rel="stylesheet" media="screen, projection, print">
确保您的样式表设置为print
媒体。
此外,在打印时,请确保“打印背景颜色已选中”