div を使用して次のようなテーブルと同じ結果を達成したいので、応答性を高め、各テーブル行の列数を調整できます。(たとえば、最初の行には 3 つのレスポンシブ列があり、2 行目には 4 つのレスポンシブ列があります)。私はまた、別のtrに単一の単語を書くことを避けたい
それを行う方法はありますか?
ここに現在のテーブルがあります
<table>
<thead>
<tr>
<th class="short-column">Short Column</th> <!-- th sets the width -->
<th class="short-column">Short Column</th> <!-- th sets the width -->
<th class="long-column">Long Column</th> <!-- th sets the width -->
</tr>
</thead>
<tbody>
<tr>
<td class="lite-gray">Short Column</td> <!-- td inherits th width -->
<td class="lite-gray">Short Column</td> <!-- td inherits th width -->
<td class="gray">Long Column</td> <!-- td inherits th width -->
</tr>
</tbody>
</table>
table { table-layout: fixed; border-collapse: collapse; border-spacing: 0; width: 100%; }
.short-column { background: yellow; width: 30%; }
.long-column { background: lime; width: 40%; }
.lite-gray { background: #f2f2f2; }
.gray { background: #cccccc; }
のようなものを使用することは可能ですか
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td>
<!--<div>THREE COLUMNS</div>-->
</td>
</tr>
<tr>
<td>
<!--<div>FOUR COLUMNS?</div>-->
</td>
</tr>
</table>