I am using an image that should automatically scale inside a div whose height is determined by the root div. Scaling is available in all major browsers, using height: 100%for the image itself. But it seems that in some browsers, the image container does not adapt its width according to its contents (image).
Check out the live demo yourself .
This demo uses an image container with a blue background.
Expected behavior: This background should not be displayed, since the width and height of the container should be the same as its contents (image).
Actual behavior :
- In Chrome 11, Safari 5, and IE9, the behavior will be as expected.

- In Firefox 3.6 / 4.0 and Opera 11, the behavior is not as expected: a blue background is displayed.

What is the main reason for this strong difference between major browsers?
source
share