簡體   English   中英

當瀏覽器寬度改變時,圖像不會在ie8中調整大小

[英]Image not resizing in ie8 when browser width changes

我正在按照這里的提示重新調整ie8中的圖像: http//blog.kurtschindler.net/post/flexible-dynamically-resizing-images-with-css

不過,我沒有運氣讓我在我的網站上工作。 我在這里寫了一些簡單的代碼來消除任何復雜性,我仍然沒有得到任何結果。 我不得不錯過一些簡單的東西。

<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>

這是您應該需要的唯一CSS:

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

圖像將隨瀏覽器縮放。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM