Hello everybody,
can someone help me with this problem:
I'm creating a page with a sidebar, and I wanted to create the sidebar as a div
which gets a "position:absolute". The problem: if the sidebar's content is
longer than the main content, my IE6 will not create a vertical scrollbar for
the page, which makes the lower part of the sidebar unreadable.
Take this code:
<!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=iso-8859-1" />
<title>Title</title>
<style type="text/css">
body{
background:yellow;
margin:40px;
}
.container{
background:blue;
border:2px solid red;
padding:15px;
position:relative;
}
.maincontent{
background:orange;
border:4px solid yellow;
margin-right:250px;
}
.sidebar{
background:green;
border:4px solid #ccc;
position:absolute;
right:5px;
top:5px;
}
p{
font-size: large;
}
</style>
</head>
<body>
<div class="container">
<div class="maincontent">
<p>main content</p>
</div>
<div class="sidebar">
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
<p>sidebar</p>
</div>
</div>
</body>
</html>
As you see, I have a "container", and within this container there is the
"maincontent" and the "sidebar". In order to get the sidebar to position in
relation to the container, and not the whole body, I gave the container a simple
"position:relative". As you can try, with IE6 you will not be able to scroll
down to read the whole sidebar. Mozilla behaves as wished.
Is this a IE6 bug?
Is there a workaround?
Am I doing something wrong? Because, if this really was a bug, absolute
positioning would have to be used with a lot of caution - the author would
always have to make sure the absolutely positioned element is not too long....
Thanks for any help,
Alex