IE doesn't support height=auto for images, wha

2020-03-09 07:12发布

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?

11条回答
甜甜的少女心
2楼-- · 2020-03-09 07:38

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

查看更多
Root(大扎)
3楼-- · 2020-03-09 07:42

i've tried all the solutions posted, and the only one that works is

height=100%
查看更多
劫难
4楼-- · 2020-03-09 07:42

In "IE9 compatibility view - IE7 Standard Document mode" leaving off height=auto may not solve the problem. Try adding conditional CSS and in your special css file for IE ("ie.css") add a line that assigns the appropriate min-height to your affected class/element.

for example:

.IE7 .[css element] {min-height: xxxpx;}

Where xxx equals the necessary image height.

查看更多
我欲成王,谁敢阻挡
5楼-- · 2020-03-09 07:46

Use height: auto together with width: auto and it is going to work in IE. If you specify only one of them, IE gets upset.

height: auto;
width: auto;
查看更多
Luminary・发光体
6楼-- · 2020-03-09 07:51

For Edge browser you can use max-height, which will also work for other browsers

max-height: 100%;
查看更多
兄弟一词,经得起流年.
7楼-- · 2020-03-09 07:51

height: initial; will work instead of using height: auto; in chrome and ie.

查看更多
登录 后发表回答