[ACCEPTED]-Scroll DIV which contains image, not Document-css

Accepted answer
Score: 13

Set a (max) width and height for the div 6 and it should work. Otherwise the div will 5 just adjust itself to the size of the image:

#mydiv {
  overflow: auto;

  max-width: 800px;  // or width instead of max-width
  max-height: 600px; // or height instead of max-height

Example 4 here: http://jsfiddle.net/x58RD/.

If it happens that you are forced 3 to support ancient browsers like IE6, you 2 need to use width and height instead of max-width and max-height anyways 1 or it still won't work.

Score: 2

You need to define a width and height. Divs 3 are block elements and will take up as much 2 space as needed. In this case as large 1 as the image is.

Score: 1

you need to fix size of div, for example:

width: 200px;
height: 200px;


More Related questions