user981053
user981053

Reputation: 621

Resizing an image with percentage attribute

I am having a problem resizing an image with the percentage attribute. I am trying to resize the image so that it is a percentage of its container. This works fine in a Chrome, but in internet explorer and firefox, it resizes it as a percentage of the original image, and not to fit its container. Are there any work arounds to get it to do what I want in explorer and firefox?

Upvotes: 0

Views: 5533

Answers (1)

MikeM
MikeM

Reputation: 27415

In this test:

  • <div> container set at 800px
  • and a child <img> within at 1000x1000 image width:50%

http://jsfiddle.net/pxfunc/QdmuD/

All browsers showed the image at 400x400 (50% of the container)

Tested in Chrome (dev build), FF 8, IE 9 (and 7,8 compat modes)

Upvotes: 1

Related Questions