2010-08-12 58 views
1

下面是一个测试HTML文件。它在屏幕上显示得很好,但是当我在Firefox 3.6.8或IE 7.0中“打印”或“打印预览”时,表格边框不会出现。我错过了什么?HTML/CSS:表格边框出现在屏幕上,但不是在打印输出?

<html> 
<head> 
    <style type="text/css"> 
     body { 
      background: black; 
      font-family: arial, sans-serif; 
      color: white; 
     } 
     table.param, table.param td, table.param th {border: 1px solid white; border-collapse: collapse; } 
     table.param td { text-align: left; vertical-align: bottom; color: white; font-size: 90%; } 
     h2,h3 { margin: 0; } 
     a:link { color: #00FF00; } 
     a:visited { color: #8080FF; } 
     a:hover { color: #FFFFFF; } 
     a:active { color: #FFFF00; } 
    </style> 
</head> 
<body><h2>Software Parameters</h2> 
    <table class="param"><tbody> 
     <tr><th>head1</th><th colspan="3">blah blah blah</th></tr> 
     <tr><td>param1</td><td>foo</td><td>2000</td><td>param1 description</td></tr> 
     <tr><td>param2</td><td>bar</td><td>4000</td><td>param2 description</td></tr> 
     <tr><td>param3</td><td>baz</td><td>3000</td><td>param3 description</td></tr> 
    </tbody></table> 
</body> 
</html> 

更新:啊哈,看起来像<style> tag has a media attribute。我适应德里克的答案,现在我明白了在IE 7.0的工作,但不火狐3.6.8(这是在Firefox中一个已知的bug?)

<html> 
<head> 
    <style type="text/css" media="print"> 
     body { 
      background: white; 
      color: black; 
     } 
    </style> 
    <style type="text/css" media="screen"> 
     body { 
      background: black; 
      color: white; 
     } 
    </style> 
    <style type="text/css"> 
     body { 
      font-family: arial, sans-serif; 
     } 
     table.param, table.param td, table.param th {border: 1px solid; border-collapse: collapse; } 
     table.param td { text-align: left; vertical-align: bottom; font-size: 90%; } 
     h2,h3 { margin: 0; } 
     a:link { color: #00FF00; } 
     a:visited { color: #8080FF; } 
     a:hover { color: #FFFFFF; } 
     a:active { color: #FFFF00; } 
    </style> 
</head> 
<body><h2>Software Parameters</h2> 
    <table class="param"><tbody> 
     <tr><th>head1</th><th colspan="3">blah blah blah</th></tr> 
     <tr><td>param1</td><td>foo</td><td>2000</td><td>param1 description</td></tr> 
     <tr><td>param2</td><td>bar</td><td>4000</td><td>param2 description</td></tr> 
     <tr><td>param3</td><td>baz</td><td>3000</td><td>param3 description</td></tr> 
    </tbody></table> 
</body> 
</html> 

回答

1

它看起来像您使用的是黑色背景白色的桌子边框,对吗?默认情况下,Firefox不会打印背景颜色,因此最终会在白色背景上显示白色边框。

您可能需要设置一个打印样式表,以反转该配色方案(白底黑白而非黑底白),以便正确打印。

+0

有没有办法与'