Forum Moderators: not2easy
Then I discovered that this is how it is shown in IE6 as well. So I tried putting position:absolute inside a <!--[if IE 6]> section but it has not worked.
Am I heading in the wrong direction? What have I got wrong?
Something like this:
<body>
<div id="sidebar">
<h1>sidebar text</h1>
</div>
<div id="main">
<h1>content of site</h1>
</div>
The stylesheets:
body{margin:0; padding:0; color:#303030; background:#fafafa url(../img/bodybg2.gif) repeat-y left top; font:76% Verdana,Tahoma,sans-serif;background-color: #E0E0E0;}
#sidebar
{position:relative; top:0; left:0; width:220px; height:100%; overflow:hidden; background:#e0e0e0 url(../img/sidebarbg.gif) top right repeat-y; text-align:right;}
body > #sidebar
{position:fixed;}
#main
{width:500px; margin:0 0 0 250px; padding:20px 6; background:#fafafa;}
then fix.css ..........
html
{overflow:hidden;}
body
{height:100%; width:100%; overflow:auto;}
#sidebar
{position:absolute;}
As I said, it worked perfectly in IE7 and in IE6 until I tried to implement the editor. But in order for the editor to work, I need to have the position:relative for the sidebar div.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
html, body {
height: 100%;
}
#container {
margin: 0 auto;
width: 90%; /* This can be %, px, em */
text-align: left; /* Needed for IE if you want the container to center */
}
#left { /* Assign margin. With no margin, columns will touch */
width: 50%; /* Will fill half container, adjust to needs*/
float: left;
}
#right { /* Assign margin. With no margin, columns will touch */
width: 50%;
float: left;
}
</style>
</head>
<body>
<div id="container">
<div id="left">Left column</div>
<div id="right">Right column</div>
</div>
</body>
</html>
Marshall
[edited by: Marshall at 10:33 am (utc) on Aug. 23, 2007]
<!--[if lte IE 6]>
<style type="text/css">
#left{ /*IE6 only rule, applied on top of the default above*/
position: absolute;
top: expression(document.compatMode=="CSS1Compat"? document.documentElement.scrollTop-40+"px" : body.scrollTop-40+"px");
}
</style>
<![endif]-->
And forget the #container
Marshall