因此,我需要我的代码让图像保持当前设置的宽高比,而不管用户是在小屏幕上查看网站,还是调整浏览器大小而不是全屏查看。在调整浏览器大小时保持长宽比
这是我迄今为止的一些代码,但我只是不确定该怎么做,同时仍然保持当前效果不变(即图像并排排列并居中)。
<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