Thomas Dose: Positionieren im Elternelement

Beitrag lesen

Liebe Leute!

Ich versuche einige div-Container innerhalb von Tabellenzellen zu positionieren. Aus dem Forum habe ich gelernt, dass die Position des Elternelents nicht -static- sein darf. Ich denke, ich habe das im script berücksichtigt. Das script funktioniert aber nur im InternetExplorer, aber nicht in firefox und Netscape.

Wo liegt der Fehler?

<html>
<head>
<title>Container-Test</title>

<style type="text/css">
<!--
body { }
#Bereich1 { position:absolute; top:25px; left:20px; width:70px; height:25px; }
#Bereich2 { position:absolute; top:50px; left:20px; width:70px; height:25px; }
#Bereich3 { position:absolute; top:75px; left:20px; width:70px; height:25px; }
#Bereich4 { position:absolute; top:100px; left:20px; width:70px; height:25px; }
-->
</style>

</head>

<body bgcolor="#FFCC99">

<table align="center" style="position:relative" border="1">

<tr style="position:relative">
           <td style="position:relative" width="100" height="150">
             <div id="Bereich1" style="background:yellow; border:solid 2px red;">Bereich1</div>
           </td>
           <td style="position:relative" width="100" height="150">
             <div id="Bereich2" style="background:yellow; border:solid 2px red;">Bereich2</div>
           </td>
         </tr>

<tr style="position:relative">
           <td style="position:relative" width="100" height="150">
             <div id="Bereich3" style="background:yellow; border:solid 2px red;">Bereich3</div>
           </td>
           <td style="position:relative" width="100" height="150">
             <div id="Bereich4" style="background:yellow; border:solid 2px red;">Bereich4</div>
           </td>
         </tr>

</table>

</body>