Reputation: 7113
I want to show an image from a URL and I want that image to have a given size but I want to maintain the ratio between height and width.
Upvotes: 1
Views: 473
Reputation: 25159
CSS:
img {
width: 30%;
height: auto;
}
Something like this?
Upvotes: 5
Reputation: 30234
you can use css to style an image
i believe if you use px for example, and specify only one dimension
img {width:100px}
the ratio is usually maintained
You can use
img {width:100px;height:auto;}
which may help
if you use
img {width:100px}
the ratio is maintained in IE 7 at least
Upvotes: 0
Reputation: 114367
<img src="http://..." height="100" />
No magic here, although client-side resizing usually looks crappy.
Upvotes: 2