colspan (Zelle über mehrere Spalten) und rowspan
(Zelle über mehrere Zeilen) aufbauen. Für komplexere Tabellen kannst du thead,
tbody und ggf. tfoot einsetzen.
Luft ist ein Gasgemisch. Die Hauptbestandteile (Volumenanteile in trockener Luft):
| Bestandteil | Formel | Anteil (vol.%) |
|---|---|---|
| Stickstoff | N2 | 78,09 % |
| Sauerstoff | O2 | 20,95 % |
| Argon | Ar | 0,93 % |
| Kohlendioxid | CO2 | 0,04 % |
| Sonstige Edelgase | – | < 0,01 % |
Diese Tabelle sollst du in HTML nachbauen.
Öffne deine (bisher leere) luft.html und ergänze Text und eine Tabelle.
<h1>-Überschrift „Luft" ein.Baue die Tabelle oben nach. Verwende:
<table> – Tabelle<thead> – Kopfbereich<tbody> – Datenteil<tr> – Tabellenzeile (table row)<th> – Kopfzelle (table header, wird fett dargestellt)<td> – Datenzelle (table data)Grundgerüst:
<table>
<thead>
<tr>
<th>Bestandteil</th>
<th>Formel</th>
<th>Anteil</th>
</tr>
</thead>
<tbody>
<tr>
<td>Stickstoff</td>
<td>N<sub>2</sub></td>
<td>78,09 %</td>
</tr>
<!-- weitere Zeilen … -->
</tbody>
</table>
Baue diese Tabelle nach
(Quelle: Wikipedia, Luft).
Sie verwendet sowohl colspan und rowspan als auch thead und
tbody:
| Gas | Formel | Anteil | |
|---|---|---|---|
| Volumen | Masse | ||
| Hauptbestandteile der trockenen Luft auf Meereshöhe | |||
| Stickstoff | N2 | 78,084 % | 75,518 % |
| Sauerstoff | O2 | 20,942 % | 23,135 % |
| Argon | Ar | 0,934 % | 1,288 % |
| Zwischensumme | 99,960 % | 99,941 % | |
border per CSS gesetzt werden muss. Das machen wir ab Tag 2. Alternativ
kannst du (veraltet, aber zum Testen) direkt am Tag schreiben:
<table border="1"> – so siehst du die Zellen schon jetzt.