【问题标题】:Extra HTML Table cell appearing under table only on print/print preview仅在打印/打印预览时出现在表格下方的额外 HTML 表格单元格
【发布时间】:2020-07-24 17:17:18
【问题描述】:

screenshot of issue 当我打印我的文档时,每个表格都会在表格下方打印一个额外的单元格(但只有一个)。我在网上到处寻找解决方案。到目前为止,我还没有找到它。我正在使用 Chrome。我没有尝试任何重要的事情,因为我还没有在互联网上找到这个问题。也许这只是我。请帮忙。

这是我的代码:

<style>

body {padding: 0px; 
  margin: 0px; 
  text-align: center;}

.noborder th {font-weight: bold; 
          border: none; 
          padding: 0px, 3px;}

.noborder td {font-weight: regular; 
          border: none; 
          padding: 0px, 3px;}

table.border {empty-cells:show;}

.border th {font-weight: bold; 
        padding: 0px, 3px;}

.border td {font-weight: regular; 
        border: 1px solid gray; }
</style>

<table class="noborder" width="100%">
   <th width="50%">Phone: 855-359-9999
   <th width="50%">Fax: 888-965-1964
      <tr width="100%">
</table>

<p>

<table class="noborder" width="100%">
      <tr width="100%">
         <td width="15%">___ Outpatient
         <td width="15%">___ Office
         <td width="15%">___ Inpatient
         <td width="15%">___ DME
         <td width="40%">___ Ambulatory Surgery Center
</table>

<p>

<table class="border" width="100%" cellspacing="0">
      <tr width="100%">
         <td width="50%"><b>ICD-10 CM Diagnosis</b>
         <td width="50%"><b>Code</b>
      <tr width="100%">
         <td width="50%">&nbsp;
         <td width="50%">&nbsp;
      <tr width="100%">
         <td width="50%">&nbsp;
         <td width="50%">&nbsp;
      <tr width="100%">
         <td width="50%">&nbsp;
         <td width="50%">&nbsp;
      <tr width="100%">
         <td width="50%">&nbsp;
         <td width="50%">&nbsp;
      <tr width="100%">
         <td width="50%"><b>Description</b>
         <td width="50%"><b>Code</b>
      <tr width="100%">
         <td width="50%">&nbsp;
         <td width="50%">&nbsp;
      <tr width="100%">
         <td width="50%">&nbsp;
         <td width="50%">&nbsp;
      <tr width="100%">
         <td width="50%">&nbsp;
         <td width="50%">&nbsp;
      <tr width="100%">
         <td width="50%">&nbsp;
         <td width="50%">&nbsp;
      <tr width="100%">
         <td width="100%" colspan="2"><b>Special circumstances:</b>
      <tr width="100%">
         <td width="100%" colspan="2">&nbsp;
         <tr width="100%">
         <td width="100%" colspan="2">&nbsp;
      <tr width="100%">
         <td width="100%" colspan="2"><b>Clinical Information:</b>
</table>

【问题讨论】:

  • 我用你的代码做了一个codepen,我没有看到底部多余的单元格。看起来不错。

标签: html printing html-table


【解决方案1】:

我猜你忘了给 tr 和 td 添加结束标签,比如:

<tr>
  <td>
     some stuff between
  </td>
</tr>

我将您的代码复制粘贴到文本编辑器中,它没有结束标签,但我没有您的图片所示的问题。我在浏览器中打开检查器,看到浏览器放置了所有结束标记。

只需为所有 trs 和 tds 添加结束标签,一切都应该按预期工作。

【讨论】:

  • 我希望这会奏效,但它没有,感谢您的尝试。这是非常令人沮丧的。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-08-12
  • 1970-01-01
  • 1970-01-01
  • 2023-04-04
  • 1970-01-01
  • 1970-01-01
  • 2015-02-21
相关资源
最近更新 更多