FrankS: Dynamische Breite bei Divs?

Beitrag lesen

Nochmal Moin.

Da ich den Link in meinem 1. Posting nicht ewig stehen lassen will, hier meine Ausgangsidee und die Lösung fürs Archiv:

******************** mein Versuch **********************

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<style type="text/css">
<!--
body {
  font-family: Arial, Helvetica, Geneva;
  font-size:10pt;
}

#logo {position:absolute; top:10px; left:10px; width:180px; z-index:1;}
#menu {position:absolute; top:90px; left:10px; width:180px; z-index:1;}
#main {position:absolute; top:10px; left:190px; z-index:2; }

-->
</style>

<script type="text/javascript">
<!--
function zoom() {
  if(document.getElementById){
    if (window.innerWidth){
      document.getElementById("main").style.width = (window.innerWidth  - 192);
    }else{
      document.getElementById("main").style.width = (document.body.offsetWidth - 210);
    }
  }
}
//-->
</script>

</head>
<body onLoad="zoom()">

<!-- kleines Logo -->
<div id="logo" style="border:solid 1px blue;">
logo logo<BR>
logo logo<BR>
</div>
<!-- Ende Logo -->

<!-- Menue -->
<div id="menu" style="border:solid 1px blue;">
Menue<BR>
Menue<BR>
Menue<BR>
Menue<BR>
Menue<BR>
</div>
<!-- Ende Menue -->

<!-- Inhalt der Seite -->
<div id="main" style="background:red; border:solid 1px blue; text-align:center;" >
Inhalt
</div>
<!-- Ende Inhalt -->

</body>
</html>

******************** die Lösung **********************

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;CHARSET=iso-8859-1">
<title>test</title>
<style type="text/css">
<!--
body {
  font-family: Arial, Helvetica, Geneva;
  font-size:10pt;
}

#logo { position:absolute; top:10px; left:10px; width:180px; }
#menu { position:absolute; top:90px; left:10px; width:180px; }
#main { margin-left:190px; }

-->
</style>
</head>
<body>

<!-- kleines Logo -->
<div id="logo" style="border:solid 1px blue;">
logo logo<BR>
logo logo<BR>
</div>
<!-- Ende Logo -->

<!-- Menue -->
<div id="menu" style="border:solid 1px blue;">
Menue<BR>
Menue<BR>
Menue<BR>
Menue<BR>
Menue<BR>
</div>
<!-- Ende Menue -->

<!-- Inhalt der Seite -->
<div id="main" style="background:red; border:solid 1px blue; text-align:center;" >
Inhalt
</div>
<!-- Ende Inhalt -->

</body>
</html>

Gruß Frank