Web Design Web Design Forum
Registration is free! Here you can view your subscribed threads, work with private messages and edit your profile and preferences Calendar Find other members Frequently Asked Questions Search
Home Web Design

Convenient web based access to our favorite web design Usenet groups

web design reviews

This is Interesting: Free Magazines for Graphics designers and webmasters  





  Last Thread  Next Thread
Author
Thread Post New Thread   

Position:absolute - missing scrollbar in IE6
 

Alexander Fischer




quote this post edit post

IP Loged report this post

Old Post  06-20-04 - 12:15 AM  
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 fo
r
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 si
mple
"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



Post Follow-Up to this message ]
Re: Position:absolute - missing scrollbar in IE6
 

Neal




quote this post edit post

IP Loged report this post

Old Post  06-20-04 - 12:15 AM  
On Sat, 19 Jun 2004 20:53:22 GMT, Alexander Fischer <afish@firemail.de>
wrote:

> 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.

height: 100%; added to .container fixes this, somehow. Can't say I'm sure
why...


Post Follow-Up to this message ]
Re: Position:absolute - missing scrollbar in IE6
 

Alexander Fischer




quote this post edit post

IP Loged report this post

Old Post  06-20-04 - 12:15 AM  
Neal <neal413@yahoo.com> typed:

> On Sat, 19 Jun 2004 20:53:22 GMT, Alexander Fischer
> <afish@firemail.de> wrote:
> 
>
> height: 100%; added to .container fixes this, somehow. Can't say I'm
> sure why...

But then, in Opera 5, the container is limited to the browser height :-(

How would you create such a sidebar?
Alex



Post Follow-Up to this message ]
Re: Position:absolute - missing scrollbar in IE6
 

Alexander Fischer




quote this post edit post

IP Loged report this post

Old Post  06-20-04 - 12:15 AM  
Neal <neal413@yahoo.com> typed:

> height: 100%; added to .container fixes this, somehow. Can't say I'm
> sure why...

Now, I tried this with my page and it strangely affected the border and
background of some headings. Try 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>some title</title>
<style type="text/css">
#maincontent{
position: relative;
height:100%;
}
.navigation{
background: blue;
}
#primary{
margin-right:9em;
}
#secondary{
background: #FA0;
position: absolute;
right: 5px;
top: 21px;
width:8em;
}
#maincontent h1{
border:solid 2px #FA0;
background:#124;
color: #FA0;
}
#maincontent h2{
border:solid 2px #124;
background:#FA0;
color: black;
}
</style>
</head>
<body>
<div class="navigation">
<p>
this is the navigation top bar
</p>
</div>
<div id="maincontent">
<div id="primary">
<h1>HEADING 1</h1>
<h2>Heading 2</h2>
<p>Paragraph</p>
<p>Paragraph</p>
<h1>HEADING 1</h1>
<h2>Heading 2</h2>
<p>Paragraph</p>
<p>Paragraph</p>
</div>
<div id="secondary">
<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>


The main container is called "maincontent", within it there is "primary" (wh
ich
takes the normal content) and "secondary" (the sidebar). I now added height=
100%
to maincontent, which fixes the scroll problem - but see: the first h1 and h
2
lost their background and border!

Isn't this strange? Anyone ever seen this bug before? (IE6)
Thanks and regards,
Alex




Post Follow-Up to this message ]
Sponsored Links
 





All times are GMT. The time now is 04:30 AM. Post New Thread   
  Previous Last Thread   Next Thread next
Stylesheets archive | Show Printable Version | Email this Page | Subscribe to this Thread

Popular forums

Adobe Photoshop forum Macromedia Flash Web Site Design
Dreamweaver FrontPage forum
JavaScript Forum XML forum
Style Sheets VRML
Forum Jump:
Rate This Thread:

 

XML RSS Feed web design latest articles Syndicate our forum via XML or simple JavaScript

Web Design archive  Database administration help  


Top Home  -  Register  -  Control Panel   -  Memberlist  -  Calendar  -  Faq  -  Search Top