问题描述
是否可能通过仅使用html和css来显示数据的描述性列(如果它是最左边的表),而不显示它(如果它在另一个表的右边)?
类似这样的东西:
table {
margin: 10px 0 10px 0;
float: left;
border-collapse: collapse;
}
td {
border: 1px solid black;
}
<table>
<tr>
<td class="description">
Descriptive Row 1 of Table 1
</td>
<td class="data">
Content Row 1 of Table 1
</td>
</tr>
<tr>
<td class="description">
Descriptive Row 2 of Table 1
</td>
<td class="data">
Content Row 2 of Table 1
</td>
</tr>
<tr>
<td class="description">
Descriptive Row n of Table 1
</td>
<td class="data">
Content Row n of Table 1
</td>
</tr>
</table>
<table>
<tr>
<td class="description">
Descriptive Row 1 of Table 2
</td>
<td class="data">
Content Row 1 of Table 2
</td>
</tr>
<tr>
<td class="description">
Descriptive Row 2 of Table 2
</td>
<td class="data">
Content Row 2 of Table 2
</td>
</tr>
<tr>
<td class="description">
Descriptive Row n of Table 2
</td>
<td class="data">
Content Row n of Table 2
</td>
</tr>
</table>
<table>
<tr>
<td class="description">
Descriptive Row 1 of Table 3
</td>
<td class="data">
Content Row 1 of Table 3
</td>
</tr>
<tr>
<td class="description">
Descriptive Row 2 of Table 3
</td>
<td class="data">
Content Row 2 of Table 3
</td>
</tr>
<tr>
<td class="description">
Descriptive Row n of Table 3
</td>
<td class="data">
Content Row n of Table 3
</td>
</tr>
</table>
显示如下:
+------------------------------+--------------------------++--------------------------+
| Descriptive Row 1 of Table 1 | Content Row 1 of Table 1 || Content Row 1 of Table 2 |
+------------------------------+--------------------------++--------------------------+
| Descriptive Row 2 of Table 1 | Content Row 2 of Table 1 || Content Row 2 of Table 2 |
+------------------------------+--------------------------++--------------------------+
| Descriptive Row n of Table 1 | Content Row n of Table 1 || Content Row n of Table 2 |
+------------------------------+--------------------------++--------------------------+
+------------------------------+--------------------------+
| Descriptive Row 1 of Table 3 | Content Row 1 of Table 3 |
+------------------------------+--------------------------+
| Descriptive Row 2 of Table 3 | Content Row 2 of Table 3 |
+------------------------------+--------------------------+
| Descriptive Row n of Table 3 | Content Row n of Table 3 |
+------------------------------+--------------------------+
我想将此用于具有不同屏幕尺寸的设备的灵活布局。对表使用float:left可以将它们包裹起来,但是我还没有找到隐藏表之间描述性列的方法。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)