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