Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 当浏览器宽度更改时,图像在ie8中不调整大小_Html_Css_Image_Internet Explorer 8 - Fatal编程技术网

Html 当浏览器宽度更改时,图像在ie8中不调整大小

Html 当浏览器宽度更改时,图像在ie8中不调整大小,html,css,image,internet-explorer-8,Html,Css,Image,Internet Explorer 8,在ie8中调整图像大小之前,我遵循以下提示: 不过,在我的网站上,我并没有幸做到这一点。我在这里写了一些简单的代码来去除任何复杂性,但我仍然一事无成。我必须错过一些简单的东西 <html> <head> <style> .container img { max-width: 100%; height: auto; width: auto; /*for ie8*/ } .container {

在ie8中调整图像大小之前,我遵循以下提示:

不过,在我的网站上,我并没有幸做到这一点。我在这里写了一些简单的代码来去除任何复杂性,但我仍然一事无成。我必须错过一些简单的东西

<html>
  <head>
  <style>
     .container img {
     max-width: 100%;
     height: auto;
     width: auto; /*for ie8*/
     }
     .container { 
     width: 100%;
     }
  </style>
  </head>
  <body>
    <div class="container">
     <img src="image.jpg" />
    </div>
  </body>
</html>

.集装箱img{
最大宽度:100%;
高度:自动;
宽度:自动;/*适用于ie8*/
}
.容器{
宽度:100%;
}

这是您需要的唯一CSS:

.container img {
    width: 100%;
 }
.container { 
    width: 100%;
}

图像将随浏览器缩放。

确保您有doctype:
应该足以测试上述示例是否正常工作。谢谢。不用担心,很高兴能帮上忙:)