再次,Internet Explorer耗費我的時間和金錢。Internet Explorer 7中圖像的最大寬度和最大高度
我正在做一個負責任的網站,我需要我的圖片是他們包含元素的不超過100%的寬度,也不會比情況下一定比例的高度就越脫落的頁面。
一些CSS:
#content{
margin:0 auto;
min-width:320px;
max-width:800px;
width:80%;
background-color:green;
}
#featured{
position:relative;
width:100%;
}
#featured-images{
text-align:center;
}
#featured-images img{
max-height:80%;
height:auto !important; /* IE fix */
height:80%; /* IE fix */
max-width:100%;
width:auto !important; /* IE fix */
width:100%; /* IE fix *
}
一些標記:
<div id="content">
<div id="featured">
<div id="featured-images">
<img src="lib/imgs/fi-1.jpg"/>
</div>
</div>
</div>
目前,此頁適用於Chrome。它甚至適用於IE6和IE8 +。我沒有在Firefox或Opera中測試過它。但IE 7絕對不會打球。它似乎將圖像縮小到很小的程度,就好像瀏覽器被重新調整爲一個殘片。
我知道這是不理想,但我一直在使用IE NetRenderer測試。
您使用最小寬度不砍最大寬度黑客 – Hushme
@Hushme你能不能解釋一下?或者提供替代方案? – shennan
你正在使用100%爲什麼你需要最大寬度? – Hushme