views:

75

answers:

2

The code below works properly in all browsers but IE. The overflow doesn't work. Thanks.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
<html>

<head>
<style type="text/css">
#scroll {
  width: 500px;
  height: 250px;
  overflow: auto;
}

.box {
  position: relative;
  height: 100px;
}
</style>

</head>
<body>
  <div id='scroll'>
    <div class='box' style="background-color: red;"></div>
    <div class='box' style="background-color: black;"></div>
    <div class='box' style="background-color: yellow;"></div>
    <div class='box' style="background-color: blue;"></div>
    <div class='box' style="background-color: green;"></div>
  </div>
</body>
</html>
+1  A: 

Is this what you are looking for? http://snook.ca/archives/html_and_css/position_relative_overflow_ie/

Petr Pechovic
+1  A: 

If you remove the "position:relative;" from the .box CSS definition, I believe it'll work in FF and IE 6.0.

Edit: I've tested it - and it works in FF 3.6.8 and I.E. 6.0.28 (i.e. keeps the 100px boxes within the scroll div).

S.Jones