Christoph Schick: Verschachtelte Tabellen im IE

Hallo alle zusammen!

Ich habe eine HTML-Seite mit 2 verschachtelten Tabellen.

Im Firefox läuft alles ohne Probleme, beim IE (6.0.3790.0) werden die Breiten der Spalten der ersten Tabelle nicht richtig berechnet.
Mir kommt es so vor als ob die Breiten der 1. Tabelle vom IE anhand der zweiten berechnet werden, da die Länge des Textes in der 2. Tabelle Einfluss auf die Breite hat.

Sobald dieser Text länger als der in der ersten Tabelle ist, passt die Aufteilung nicht mehr...

Im Sample (weiter unten) habe ich 2x 2 verschachtelte Tabellen eingebaut, mit unterschiedlichen Textlängen, so dass man das Problem schön sieht.

Hat irgendjemand eine Idee woran das liegen kann???

Danke!
Schöne Grüße
Christoph

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<title>test</title>
</head>
<body>
<table width="100%" cellspacing="0" border="1" cellpadding="0">
  <tr >
    <td> short text </td>
    <td width="75"> 4 </td>
  </tr>
  <tr>
    <td colspan="2">
     <table width="100%" cellspacing="0" border="1" cellpadding="0">
        <tr>
          <td> text is longer than text above </td>
          <td width="75"> 0 </td>
        </tr>
      </table>
     </td>
  </tr>
</table>
<br /><br />
<table width="100%" cellspacing="0" border="1" cellpadding="0">
  <tr >
    <td> very very long text </td>
    <td width="75"> 4 </td>
  </tr>
  <tr>
    <td colspan="2">
     <table width="100%" cellspacing="0" border="1" cellpadding="0">
        <tr>
          <td> text is shorter</td>
          <td width="75"> 0 </td>
        </tr>
      </table>
     </td>
  </tr>
</table>
</body>
</html>

  1. Hallo,

    Sobald dieser Text länger als der in der ersten Tabelle ist, passt die Aufteilung nicht mehr...

    Hat irgendjemand eine Idee woran das liegen kann???

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html>
    <head>
    <title>test</title>

    <style type="text/css">
    table { table-layout:fixed; }
    </style>

    ....

    Grüße
    Thomas

    1. <style type="text/css">
      table { table-layout:fixed; }
      </style>

      Danke Thomas, das wars :)

      Gibts da eigentlich eine Erklärung dafür?

      Christoph

      1. Hallo,

        <style type="text/css">
        table { table-layout:fixed; }
        </style>

        Danke Thomas, das wars :)

        bitte :-)

        Gibts da eigentlich eine Erklärung dafür?

        Ja: http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/tablelayout.asp
        ----------
        auto:
        Default. Column width is set by the widest unbreakable content in the column cells.

        fixed:
        Table and column widths are set either by the sum of the widths on the col objects or, if these are not specified, by the width of the first row of cells. If no width is specified for the table, it renders by default with width=100%
        ----------

        Grüße
        Thomas