因此,我需要我的代碼讓圖像保持當前設置的寬高比,而不管用戶是在小屏幕上查看網站,還是調整瀏覽器大小而不是全屏查看。在調整瀏覽器大小時保持長寬比
這是我迄今爲止的一些代碼,但我只是不確定該怎麼做,同時仍然保持當前效果不變(即圖像並排排列並居中)。
<style>
.first-image {
display:inline-block;
text-align:left;
}
.second-image {
display:inline-block;
text-align:right;
}
<body>
<center>
<div class="first-image">
<a href="index.html"><img src="img/leftbryce.png" onmouseover="this.src='img/whiteleftbryce.png'" onmouseout="this.src='img/leftbryce.png'" width="800 px" height="auto"></a>
</div>
<div class="second-image">
<img src="img/whiterightbryce.png" onmouseover="this.src='img/rightbryce.png'" onmouseout="this.src='img/whiterightbryce.png'" width="800 px" height="auto">
</div>
</center>
我怎麼可能保持中心對齊,雖然圖像?有沒有辦法讓他們填滿屏幕? – unowncoder
中心對齊父母div或圖像我不明白嗎? –
我需要兩個圖像在中心對齊 – unowncoder