Shaun Mccran

My digital playground

06
S
E
P
2011

Position:relative and overflow CSS issues in Internet Explorer

I was working on a project this week and in the final testing phases I noticed that there was some unusual behaviour in Internet explorer.

A div with an overflow of auto had elements within it that had a position: relative class. The problem here was that the elements remained fixed in place, and the scrollbar was no longer scrolling their content.

view plain print about
1.group-holder { position:relative; overflow: auto; width: 750px; height: 200px; }
2
3.relative-element {height: 200px; position:relative;}

This is pretty standard code, I've added the 'overflow: auto' value to the containing div element. To solve the problem of having fixed elements inside this just add the position:relative attribute to each offending element. Its a weird little bug I haven't seen before and it looks like it only happens in IE 6 and 7.

TweetBacks
Comments
Back to top