1

我有一个 90 像素 x 90 像素的图像(它是一个 jpg 文件),但我不知道如何在 Internet Explorer 中将其设置为 60 像素 x 60 像素。我已经查看了一些网站,它们告诉我使用这种 css 样式:

.img { -ms-interpolation-mode: bicubic; }

但什么也没发生。这是我目前正在使用的 css,它在 fireforx 和 chrome 中运行良好:

.img {
    horiz-align: center;
    width: 60px;
    height: 60px;
    margin: 10px;
    border: 1px rgb(218, 218, 218) solid;
    background: #C4C4C4 no-repeat 0 0;
}
4

2 回答 2

4

您的原始代码的问题是您将 img 指定为一个类,.img而不是img

这里有两种方法可以做到这一点。第一个没有CSS:

<img src="your-image.jpg" alt="" width="60" height="60" />

第二个与CSS:

<img src="your-image.jpg" alt="" class="image-resize" />

...

img.image-resize { 
  width: 60px;
  height: 60px; }
于 2013-07-31T16:34:51.180 回答
0

您可以尝试使用inherit:-

img {
  width: inherit;  /* This makes the next two lines work in IE8. */
  max-width: 100%;
  height: auto;   
}
于 2013-07-31T16:09:28.343 回答