Internet Explorer 9 - 按比例调整图像大小

时间:2011-10-26 22:27:22

标签: css image resize

我只想用CSS限制图像宽度:

#lateral-derecho #patrocinadores img
{
    max-width: 130px;
    height: auto;
    margin: 0 auto;
}

除IE 9外,每个浏览器都可以正常运行。但这并不是按比例进行的。我在<meta http-equiv="X-UA-Compatible" content="IE=8" />中运行它。

BTW,标准模式下的IE 9甚至不理解margin: 0 auto;或者我做错了什么?他们又做了一个糟糕的浏览器?

编辑:这是所有的CSS,容器(#patrocinadores)和img,img包含在#patrocinadores > a > img中:

#lateral-derecho #patrocinadores
{
    float: right;
    width: 136px; 
    margin-top: 25px;
    padding: 15px 0 5px;
    background: url(images/top-patrocinadores.png) top no-repeat #eee;
    text-align: center;
}

#lateral-derecho #patrocinadores a{display: block;}
#lateral-derecho #patrocinadores img
{
    max-width: 130px;
    height: auto;
    margin: 0 auto;
}

2 个答案:

答案 0 :(得分:1)

试试这个:

#lateral-derecho #patrocinadores a {
    display: block;
    max-width: 130px;
}
#lateral-derecho #patrocinadores img {
    max-width: 100%;
}

如果你想要IE的高质量缩放&lt; 9,您需要添加AlphaImageLoader并将sizingMethod设置为scale

答案 1 :(得分:0)

摆脱height: auto;。你不需要它,这是问题的原因。

相关问题