PDA

View Full Version : CSS: img {height: 100%;} in IE


piz
08-01-2003, 12:53 PM
Hi, just another CSS question...

Is there any reason that the Internet Explorer does not accept the style height:100% for images?

Or is it a Bug or is it my fault and it should be accepted?

Saludo
piz

MotherNatrsSon
08-01-2003, 03:59 PM
Look at this.

http://www.w3schools.com/css/tryit.asp?filename=trycss_height

MNS

Roy Sinclair
08-01-2003, 04:09 PM
Actually it does work but you've got to put the image into a "containing block element" first. Wrap the image in a div 400px tall and the image will be 400px tall (actually margins, borders and padding can alter that a bit).

I got the same results in Moz 1.4 so it's not a "unique to IE" thing (this time).

Awk
01-15-2009, 06:51 PM
Actually it does work but you've got to put the image into a "containing block element" first. Wrap the image in a div 400px tall and the image will be 400px tall (actually margins, borders and padding can alter that a bit).

I got the same results in Moz 1.4 so it's not a "unique to IE" thing (this time).

If the div has no height set ( it is determined by the content inside ), is there a way to make the image 100% of the width and height of that containing div?

It works fine in Firefox but not in IE.