2013-05-01 72 views
0

工作我用下面的代碼片段在我的CSS:最大寬度標籤不與IE

img { 
    /* Responsive images (ensure images don't scale beyond their parents) */ 

    max-width: 100%; 
    /* Part 1: Set a maxium relative to the parent */ 

    width: auto\9; 
    /* IE7-8 need help adjusting responsive images */ 

    height: auto; 
    /* Part 2: Scale the height according to the width, otherwise you get stretching */ 

    vertical-align: middle; 
    border: 0; 
    -ms-interpolation-mode: bicubic; 
} 

然而,max-width不與IE瀏覽器和圖像放大。任何修復/解決方案?

+0

'width:auto;無論如何,height:auto'是默認值,所以不需要包含它們。 (你的意思是在那裏有'\ 9'?)最大寬度應該工作,除非你在談論一個已經過時的非常老版本的IE。 – 2013-05-01 12:36:10

+0

您使用的是什麼版本的IE?如果它是最近的版本,你有沒有檢查過你是否處於標準模式,而不是怪癖模式? – Spudley 2013-05-01 12:37:18

+0

@ ralph.m:如果HTML img標記具有(或可能具有)「width」和「height」的HTML屬性,則需要'auto'。 'auto'覆蓋HTML屬性。 – 2013-05-01 16:53:32

回答

0

試試這個:

width: inherit; 

應該可以解決任何問題,IE瀏覽器。

+1

「任何IE問題」是一個有點牽強;)我認爲這解決了IE8瀏覽器模式的問題。 – MMM 2013-05-01 14:52:16