Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE doesn't support height=auto for images, what should I use?

Tags:

I have some images with height=auto because sometimes they are different heights whereas they are always the same width. It works in every browser but I.E., is there something similar I can use?

like image 690
Travis J Avatar asked Dec 29 '11 20:12

Travis J


People also ask

Why I can't change the height of image in HTML?

There is no command for changing an image size. Image dimensions are 'properties' which can be expressed in either the HTML <img> element, as width="150" height="100" attributes in the tag; or, the CSS as style rules applying to specific images.

Why should you include the height and width specifications for all images?

Web performance advocates have often advised to add dimensions to your images for best performance to allow the page to be laid out with the appropriate space for the image, before the image itself has been downloaded.

How do you change the width and height of a picture?

The height and width of an image can be set using height and width attribute. The height and width can be set in terms of pixels. The <img> height attribute is used to set the height of the image in pixels. The <img> width attribute is used to set the width of the image in pixels.


2 Answers

I found that adding min-height:1px solves the issue. Not sure why, but, worked for me.

like image 158
WebDude0482 Avatar answered Sep 20 '22 15:09

WebDude0482


Just leave

height=auto 

out. If it's not given it's "auto" by default...

like image 25
Dion Avatar answered Sep 21 '22 15:09

Dion