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

标签 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" /> 中运行它.

顺便说一句,标准模式下的 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;
}

最佳答案

试试这个:

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

如果您想为 IE < 9 进行高质量缩放,您需要包含 AlphaImageLoader 并将 sizingMethod 设置为 scale

关于css - Internet Explorer 9 - 按比例调整图像大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7909696/

相关文章:

css - font awesome 仅更改 html 中的字体大小,而不是 css

image - Matlab 使用线性索引对二维进行索引,同时保持第三维不变

css - 如何调整任何屏幕尺寸的 div 和内容?

页面上的 HTML 垂直可调整大小区域

C++如何在复制时保留字符串容量

html - 向 WP 自定义字段添加两个值

css - Koala Sass - 为什么 autoprefixer 不起作用?

python - 错误: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\imgproc\src\resize.cpp:4045: error: (-215:Assertion failed)

image - 在 vue.js 中渲染 base64 图片

jquery - 使用标签 html css 和 jquery