css打印字体不变

时间:2010-09-01 10:32:06

标签: html css

我正在设计一个打印机友好页面,我试图改变CSS中的字体属性[font-size,font-family]。我不知道我在这里做错了什么。我为CSS文件中的body标签指定的字体属性似乎根本不起作用。

可以somone请向我解释我在这里做错了什么?

HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
  <head>
   <title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" media="print" href="print.css">
</head>

<body>
<div id="wrapper">
    <table width="100%" border="1">
        <tr >
            <td >Job No</td>
            <td>4589</td>
        </tr>
        <tr>
            <td>Job No</td>
            <td>6578</td>
        </tr>
    </table>
</div>
</body>
</html>

CSS

/* CSS Document */
div#wrapper 
{
    margin-left:auto;
    margin-right:auto;
    width:auto;

}
body {
background-color: transparent;
font-size: 12pt;
font-family:'Times New Roman',Times,serif;
color:#000000; }

2 个答案:

答案 0 :(得分:6)

尝试明确指定td的字体属性:

table tr td {
  font-size: 12pt;
  font-family:'Times New Roman',Times,serif;
}

答案 1 :(得分:0)

尝试使用此CSS。

#wrapper
{
  margin-left:auto;
  margin-right:auto;
  width:auto;
}

#wrapper table
{
  font-family:"Times New Roman", Times, serif;
  font-size: 12pt;
}

body 
{
  background-color: transparent;
  font-family:"Times New Roman", Times, serif;
  font-size: 12pt;
  color:#000000; 
}