Tabelle mit fixer Spaltenbreite für Netscape-Navigator
Marcus
- css
Hallo,
ich möchte eine Tabelle erzeugen, die bei Änderung der Größe des Browserfensters die Spaltenbreite nicht ändert. Dazu habe ich die CSS-Eigenschaft "table-layout:fixed" gesetzt. Aber irgendwie funktioniert meine Implementierung nur bei Anzeige im IE. Der Netscape Navigator verändert die Spaltenbreite, wenn man das Browserfenster verkleinert.
Meine Frage: Wie bekomme ich fixe Spaltenbreiten im Navigator?
Zur Ansicht eine kleine Testdatei: www.marcuspopp.de/temp.html
Hallo Marcus,
Meine Frage: Wie bekomme ich fixe Spaltenbreiten im Navigator?
Also vorneweg: Netscape 4.x unterstützt kein table-layout: fixed; - und mir ist kein Workaround bekannt.
Netscape ab 6.x unterstützt table-layout: fixed; - allerdings sehr streng nach dem Standard.
Im Standard steht nämlich unter http://www.w3.org/TR/REC-CSS2/tables.html#fixed-table-layout, dass table-layout: fixed; nur dann zu beachten ist, wenn die Tabelle selbst eine Breite zugewiesen bekommen hat:
| The table's width may be specified explicitly with the 'width' property.
| A value of 'auto' (for both 'display: table' and 'display: inline-table')
| means use the automatic table layout algorithm.
Also statt
<table style="table-layout: fixed;">
<tr>
<td style="width: ...;">...</td>
<td style="width: ...;">...</td>
<td style="width: ...;">...</td>
</tr>
</table>
musst Du
<table style="table-layout: fixed; width: ...;">
<tr>
<td style="width: ...;">...</td>
<td style="width: ...;">...</td>
<td style="width: ...;">...</td>
</tr>
</table>
schreiben. (wobei die width-Angabe im <table> sinnvollerweise die Summe der Einzelangaben ist)
Danach hält sich der Netscape desweiteren an den Standard, was <td>s mit zu großen Inhalten angeht:
| In this manner, the user agent can begin to lay out the table once the
| entire first row has been received. Cells in subsequent rows do not affect
| column widths. Any cell that has content that overflows uses the
| 'overflow' property to determine whether to clip the overflow content.
Daher musst Du im Endeffekt schreiben:
<table style="table-layout: fixed; width: ...;">
<tr>
<td style="width: ...; overflow: hidden;">...</td>
<td style="width: ...; overflow: hidden;">...</td>
<td style="width: ...; overflow: hidden;">...</td>
</tr>
</table>
Viele Grüße,
Christian