Ich habe diese grundlegende Tabelle, wo ich Row-Elemente so rendern soll, dass es in vertikaler Reihenfolge rendern sollte. Jede <td>
innerhalb <tr>
sollte in vertikaler Reihenfolge gedruckt werden.HTML-Tabelle, um spaltenweise zu rendern
CSS und HTML:
table.spec-table {border: 1px solid #fff; width: 100%; margin: 0 0 4em 0}
table.spec-table>tr>th {background-color: #333; color: #fff; font-weight: bold;}
table.spec-table tr:nth-child(even) {background: #ddd}
table.spec-table tr:nth-child(odd) {background: #eee}
table.spec-table tr:first-child {background: #666; color: #fff; font-weight: bold}
table.spec-table th, td {font-size: .9em; padding: 7px; text-align: left;}
<table class="spec-table" id="here_table">
<tr>
<th colspan='4'>Single Mode</th>
</tr>
<tr>
<td> </td>
<td>feature1</td>
<td>feature2</td>
<td>feature3</td>
</tr>
<tr>
<td>value1</td>
<td>value2</td>
<td>value3</td>
<td>value4</td>
</tr>
<tr>
<td>test1</td>
<td>test2</td>
<td>test3</td>
<td>test4</td>
</tr>
</table>
Um diese Aufgabe zu erfüllen, habe ich nur noch zwei CSS-Eigenschaft und sein Rendering als erwartet, aber der Tabellenentwurf verstreut.
table.spec-table {border: 1px solid #fff; width: 100%; margin: 0 0 4em 0}
table.spec-table>tr>th {background-color: #333; color: #fff; font-weight: bold;}
table.spec-table tr:nth-child(even) {background: #ddd}
table.spec-table tr:nth-child(odd) {background: #eee}
table.spec-table tr:first-child {background: #666; color: #fff; font-weight: bold}
table.spec-table th, td {font-size: .9em; padding: 7px; text-align: left;}
tr.orientation { display: inline-block;}
tr.orientation th, tr.orientation td { display:block; }
<table class="spec-table" id="here_table">
<tr>
<th colspan='4'>Single Mode</th>
</tr>
<tr class="orientation">
<td> </td>
<td>feature1</td>
<td>feature2</td>
<td>feature3</td>
</tr>
<tr class="orientation">
<td>value1</td>
<td>value2</td>
<td>value3</td>
<td>value4</td>
</tr>
<tr class="orientation">
<td>test1</td>
<td>test2</td>
<td>test3</td>
<td>test4</td>
</tr>
</table>
Kann mir jemand helfen, den Tabellenentwurf zu beheben wie vor ähnlich aussehen.
Was ist, wenn
drucken Sie können max-width für
Ist das, was Sie meinen?
Quelle
2017-11-27 05:30:21 justch4
Quelle
2017-11-27 05:31:00
Die Tabelle wird nicht spaltenweise rendering. –
Verwandte Themen