我最近試驗過這個問題;瀏覽器不關心IMG元素的大小
<div class="row">
<div class="column">
<img id="first" width=275 height=385 src="flower-275x385.jpg" />
</div>
<div class="column">
<img id="second" width=100 height=400 src="flower-275x385.jpg" />
</div>
<div class="column">
<img id="third" width=500 height=150 src="flower-275x385.jpg" />
</div>
<div class="column">
<img id="fourth" width=75 height=150 src="flower-275x385.jpg" />
</div>
<div class="column">
<img id="fifth" width=750 height=550 src="flower-275x385.jpg" />
</div>
</div>
<style>
.row {
width:100%;
overflow:hidden ;
}
.column {
width:20% ;
float:left ;
}
.column img {
width:100% ;
height:auto ;
}
</style>
在HTML邊有許多不同的尺寸相同的圖像,
但瀏覽器只照顧圖像自然大小的,
這就是爲什麼所有圖像的jsfiddle,
呈現相同的尺寸上的結果側 熱到強制瀏覽器照顧基於HTML的寬度/高度?
這裏是它的JSFiddle。
編輯:看來沒有辦法沒有JS:My Solution,謝謝你上面的建議!
它看起來凌亂,但它會具有相同的「寬度」 – Digerkam 2013-02-09 14:30:07
@Digerkam我不知道您的評論應該是什麼意思? – robertc 2013-02-09 14:36:46
對不起,我的英文,我的意思是他們看起來很混亂。他們必須在相同的寬度,但不同的高度。 – Digerkam 2013-02-09 14:38:48