Matthias Apsel: vertikaler Text in Tabellenkopf

Beitrag lesen

Om nah hoo pez nyeetz, Bastian!

Über Tabellen solltest du noch viel lernen: etwa im Wiki http://wiki.selfhtml.org/wiki/CSS/Eigenschaften/Tabellenformatierung

Achtung:Rotation funktioniert nur im Firefox, da ich hier mal auf die alternativen CSS-Rotationsbefehle verzeichtet hab

Es gibt keine CSS-Befehle

Also ich will, dass Zellenspalte 1 genau 50px breit ist

table-layout: fixed; erlaubt solche festgelegten Breiten, allerdings nur, wenn auch eine Gesamtbreite vorgegeben ist.

UND der Text des Tabellenkopf 1 einzeilig

white-space: nowrap;

UND der Tabellenkopftext 1 genau mittig unten in seiner Zelle beginnt.

Damit der dann auch einen grünen Hintergrund hat, musste ich ein wenig tricksen.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">  
<html>  
  <head>  
    <meta http-equiv="content-type" content="text/html; charset=utf-8">  
    <title>Vertikaler Tabellenkopf</title>  
    <style type="text/css">

~~~css table {
        table-layout: fixed;
        border-collapse: separate;
        margin: 200px 0 0 200px;
        width: 150px;
      }
      td {
        border: 1px solid;
      }
      th:first-child {
        -moz-transform: rotate(-90deg);
        white-space: nowrap;
        text-align: left;
        width: 50px;
      }
      th:first-child span {
        background: green;
        padding: 16px 4px;
        margin-left: 4px;
      }

    ~~~html
</style>  
  </head>  
  <body>  
    <table>  
      <thead>  
        <tr>  
          <th><span>Der erste Tabellenkopf</span></th>  
          <th>Der zweite Tabellenkopf</th>  
        </tr>  
      </thead>  
      <tbody>  
        <tr>  
          <td>Zelle 1</td>  
          <td>Zelle 2</td>  
        </tr>  
      </tbody>  
    </table>  
  </body>  
</html>

Aber ich gebe zu: Richtig schön ist das nicht.

Matthias

--
1/z ist kein Blatt Papier.