I have a markup with two containers. The first one is set to "position:absolute" with all 4 "coordinates" to expand all over the site (left=right=bottom=top=30px).
Inside that container is another container with its height set to "100%" and "display:inline-block" ("inline-block" because that 2nd container should expand itself horizontally only to the required width).
Inside the 2nd container is an image with its height set to "100%" and its width set to "auto", so that the image is always as tall as the two containers and still has the correct proportion.
I need this 2nd container because I want to place some absolute positioned elements inside this container to always appear on the right side of the image.
The problem is the following: In Firefox this 2nd container does not grow/expand horizontally with the auto-width of the image. It stays at the original width of the image. No Problem in Safari/Chrome, only Firefox.
Here you can find an example-fiddle: http://jsfiddle.net/EGRCQ/ The 1st container is the blue one. Inside this you will find the 2nd container (red) and inside this container an example image. If you reduce the height of the output window below 180px you will see the problem (red container becomes visible) or you just use Firebug to inspect its width.
HTML
<body>
<div id="container1">
<div id="container2">
<img src="http://cdn4.spiegel.de/images/image-491267-thumb-wjvo.jpg"
width="180" height="180" />
</div>
</div>
</body>
CSS
html, body {
width: 100%;
height: 100%;
}
body {
margin: 0;
padding: 0;
}
#container1 {
background: aqua;
position: absolute;
top: 30px;
left: 30px;
bottom: 30px;
right: 30px;
}
#container2 {
background: red;
height: 100%;
display: inline-block;
}
#container2 img {
height: 100%;
width: auto;
}
thanks,
daniel