Re: height="100%"



On Jun 26, 7:07 pm, Chase Preuninger <chasepreunin...@xxxxxxxxx>
wrote:
If I were to create an image <img src="..." width="100%" height="100%"/> the with would span the entire width of its container but the height

does not span the entire height.  Why, and how can I change this?

100% height is 100% of the actual picutre size, so if its 200 pixels
high, then your image will display 200px high if you say 100%. It will
not stretch to fill 100% height of the container it is in.

Also, the 100% height property of say table cells doesn't function if
you have any DOCTYPE tag set at the top of your page as its regarded
as an invalid tag in the specification for the doctype.

If you want it to fill the container, then you need to set it in
pixels to whatever the height of the container is. If your container
is of a variable height then you will need some javascript to manually
set the height of the image using the onLoad="" event of the body tag.

If it was a div for example then your onload code needs to do
something like document.getElementById('imgID').height =
document.getElementById('divID').offsetHeight;

Regards,
John
.