html - CSS image's container scaling with a 100% height -


i'm using image must auto-scale inside div height defined root div. scaling fine in major browsers, using height: 100% on image itself. seems on browsers, image container doesn't adapt width accordingly content (the image).

check live demo.

this demo uses image container blue background.

expected behavior: background shouldn't display since container width , height should same content (the image).

actual behavior:

  • on chrome 11, safari 5 , ie9, behavior expected.

on chrome 12

  • on firefox 3.6/4.0 , opera 11, behavior not expected: blue background displayed.

on opera 11

what root cause of strong difference between major browsers?

in case of firefox, looks bug. filed https://bugzilla.mozilla.org/show_bug.cgi?id=653739

you can work around removing overflow:hidden unless need it.


Comments