我有一张类似于This one的表格,如下所示:
<table class="DynaTable">
<tr class="DynaTableHead">
<th class="DynaTableHeadCell-1">col 1</th>
<th class="DynaTableHeadCell-2">col 2</th>
<th class="DynaTableHeadCell-3">col 3</th>
<th class="DynaTableHeadCell-4">col 4</th>
<th class="DynaTableHeadCell-5">col 5</th>
</tr>
<tr class="DynaTableRow">
<td class="DynaTableRowCell-1">cell 1-1</td>
<td class="DynaTableRowCell-2">cell 1-2</td>
<td class="DynaTableRowCell-3">cell 1-3</td>
<td class="DynaTableRowCell-4">cell 1-4</td>
<td class="DynaTableRowCell-5">cell 1-5</td>
</tr>
<tr class="DynaTableRow">
<td class="DynaTableRowCell-1">cell 2-1</td>
<td class="DynaTableRowCell-2">cell 2-2</td>
<td class="DynaTableRowCell-3">cell 2-3</td>
<td class="DynaTableRowCell-4">cell 2-4</td>
<td class="DynaTableRowCell-5">cell 2-5</td>
</tr>
<tr class="DynaTableRow">
<td class="DynaTableRowCell-1">cell 3-1</td>
<td class="DynaTableRowCell-2">cell 3-2</td>
<td class="DynaTableRowCell-3">cell 3-3</td>
<td class="DynaTableRowCell-4">cell 3-4</td>
<td class="DynaTableRowCell-5">cell 3-5</td>
</tr>
<tr class="DynaTableRow">
<td class="DynaTableRowCell-1">cell 4-1</td>
<td class="DynaTableRowCell-2">cell 4-2</td>
<td class="DynaTableRowCell-3">cell 4-3</td>
<td class="DynaTableRowCell-4">cell 4-4</td>
<td class="DynaTableRowCell-5">cell 4-5</td>
</tr>
</table>
当用户在移动设备上加载页面时,我希望这样做,使其显示为This one,如下所示:
<table class="DynaTable">
<tr class="DynaTableHead">
<th rowspan="2" class="DynaTableHeadCell-1">col 1</th>
<th class="DynaTableHeadCell-2">col 2</th>
<th class="DynaTableHeadCell-3">col 3</th>
<th class="DynaTableHeadCell-4">col 4</th>
<th class="DynaTableHeadCell-5">col 5</th>
</tr>
<tr class="DynaTableHead">
<th class="DynaTableHeadCell-X" colspan="3">col 3</th>
</tr>
<tr class="DynaTableRow">
<td rowspan="2" class="DynaTableRowCell-1">cell 1-1</td>
<td class="DynaTableRowCell-2">cell 1-2</td>
<td class="DynaTableRowCell-3">cell 1-3</td>
<td class="DynaTableRowCell-4">cell 1-4</td>
<td class="DynaTableRowCell-5">cell 1-5</td>
</tr>
<tr>
<td class="DynaTableRowCell-X" colspan="3">cell 1-3</th>
</tr>
<tr class="DynaTableRow">
<td rowspan="2" class="DynaTableRowCell-1">cell 2-1</td>
<td class="DynaTableRowCell-2">cell 2-2</td>
<td class="DynaTableRowCell-3">cell 2-3</td>
<td class="DynaTableRowCell-4">cell 2-4</td>
<td class="DynaTableRowCell-5">cell 2-5</td>
</tr>
<tr>
<td class="DynaTableRowCell-X" colspan="3">cell 2-3</th>
</tr>
<tr class="DynaTableRow">
<td rowspan="2" class="DynaTableRowCell-1">cell 3-1</td>
<td class="DynaTableRowCell-2">cell 3-2</td>
<td class="DynaTableRowCell-3">cell 3-3</td>
<td class="DynaTableRowCell-4">cell 3-4</td>
<td class="DynaTableRowCell-5">cell 3-5</td>
</tr>
<tr>
<td class="DynaTableRowCell-X" colspan="4">cell 3-3</th>
</tr>
<tr class="DynaTableRow">
<td rowspan="2" class="DynaTableRowCell-1">cell 4-1</td>
<td class="DynaTableRowCell-2">cell 4-2</td>
<td class="DynaTableRowCell-3">cell 4-3</td>
<td class="DynaTableRowCell-4">cell 4-4</td>
<td class="DynaTableRowCell-5">cell 4-5</td>
</tr>
<tr>
<td class="DynaTableRowCell-X" colspan="3">cell 4-3</th>
</tr>
</table>
如何仅使用HTML和CSS来完成这项工作?我“可以”使用JavaScript / jquery,但我真的不愿意。输出是重要的。当移动加载它时,我可以从第一个输出转到第二个输出,或者我可以从移动版本转到桌面版本 - 做后者会使得避免JavaScript变得不那么重要。 CSS现在是否提供了rowspan / colspan选项(我上次尝试时没用,但那是3 - 5年前)?