Kann ich einen HTML-Tabellenkopf über zwei Tabellenspalten haben? Wie Zusammenführen und Zentrieren in Excel?

Lesezeit: 2 Minuten

Benutzeravatar von Lizza
Lisa

Ich möchte, dass ein Tabellenkopf über zwei Tabellenspalten nebeneinander zentriert wird. Ist das möglich?

<th colspan="2">. This .</th>

Etwas extrapolieren…

<table>
  <thead>
    <tr>
      <th>Single Column</th>
      <th colspan="2">Double Column</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Column One</td>
      <td>Column Two</td>
      <td>Column Three</td>
    </tr>
  </tbody>
</table>

Das sollte Ihnen genug geben, um damit zu arbeiten.

Wenn Sie nur 2 Spalten haben, würde ich die Verwendung vorschlagen <caption>. Verwenden Sie andernfalls colspan wie in anderen Antworten vorgeschlagen.

<table>
  <caption>This will span all columns.</caption>
  <tr><td>column one</td><td>column two</td></tr>
</table>

Natürlich. Bitte beziehen Sie sich auf diese Seite. Sie suchen nach dem Attribut namens colspan für Tabellenkopfzellen.

Benutzeravatar von Srikrushna
Srikrushna

Wir können es besser machen.

<table border="1"> 
  <tr>
    <th colspan="1" scope="colgroup">Test Heading</th>
    <th colspan="3" scope="colgroup">Mars</th>
    <th colspan="3" scope="colgroup">Venus</th>
    <th colspan="3" scope="colgroup">Test</th>
  </tr>
  <tr>
    <th rowspan="2"></th>
    <th scope="col">Produced</th>
    <th scope="col">Sold</th>
    <th scope="col">Sold</th>
    <th scope="col">Produced</th>
    <th scope="col">Sold</th>
    <th scope="col">Sold</th>
    <th scope="col">Test 1</th>
    <th scope="col">Test 2</th>
    <th scope="col">Test 3</th>
  </tr>
</table>

Bitte besuche Tabellenref Von w3.org wenn du mehr wissen willst.

1436870cookie-checkKann ich einen HTML-Tabellenkopf über zwei Tabellenspalten haben? Wie Zusammenführen und Zentrieren in Excel?

This website is using cookies to improve the user-friendliness. You agree by using the website further.

Privacy policy