html - 表格标题中的巨大空白

标签 html css

我正在尝试创建一个表。目前它只有 2 个标题 - 一个带有表格,一个带有图表。第一个标题有一个巨大的空白空间,如下图所示:

enter image description here

我的 HTML:

<table id="patient-table">
  <th>
    <table id="data-table">
      <tr>...</tr>
    </table>
  </th>
  <th>
      <ngx-charts-polar-chart [view]="view" [scheme]="colorScheme" [results]="patientService.patientLevel3.latestReading" [gradient]="gradient"
        [xAxis]="showXAxis" [yAxis]="showYAxis" [legend]="showLegend" legendTitle="" [showXAxisLabel]="showXAxisLabel"
        [showYAxisLabel]="showYAxisLabel" [xAxisLabel]="xAxisLabel" [yAxisLabel]="yAxisLabel" [autoScale]="autoScale">
      </ngx-charts-polar-chart>
  </th>
</table>

我的 CSS:

#data-table{
 border-collapse: collapse;
 font-size: 14px;
}

#data-table th, tr, td{
 border: 1px solid black;
}

#patient-table{
 clear: both;
}

如何将表格移动到其单元格的顶部以消除该空间?

最佳答案

您已将内容添加到表头元素中。这应该只用于列标题。而是将内容移动到表格行。尝试

<table id="patient-table">
  <th>
      Table
  </th>
  <th>
      Chart
  </th>
  <tr>
   <td>
    <table id="data-table">
      <tr>...</tr>
    </table>
   </td>
  </tr>
  <tr>
    <td>
     <ngx-charts-polar-chart [view]="view" [scheme]="colorScheme" [results]="patientService.patientLevel3.latestReading" [gradient]="gradient"
        [xAxis]="showXAxis" [yAxis]="showYAxis" [legend]="showLegend" legendTitle="" [showXAxisLabel]="showXAxisLabel"
        [showYAxisLabel]="showYAxisLabel" [xAxisLabel]="xAxisLabel" [yAxisLabel]="yAxisLabel" [autoScale]="autoScale">
      </ngx-charts-polar-chart>
    </td>
  </tr>
</table>

关于html - 表格标题中的巨大空白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45202924/

相关文章:

javascript - Pie Chat 没有显示在浏览器中我使用的是带有简单 HTML 的 D3

css - SCSS——最好的组织方式

css - 如何更改 Material-UI TextField InputAdornment 背景颜色?

php - 这段代码是什么意思 : `$Odd = ($Odd == "even") ? "odd": "even";` ?

html - 导航栏与 HTML 和 CSS 对齐

html - 如何改变ie中浏览输入类型浏览按钮的颜色

jquery - 为什么两个圆圈作为光标会导致垂直或水平滚动条?

html - 文本区域到全尺寸

html - 液体布局和边框

css - 移动浏览器在较小的屏幕尺寸(移动设备)上显示 768px+ 的断点样式