我想实现画廊 div 中的图像将是画廊 div 高度的 100% 并保持纵横比
和
图像会像您更改浏览器的大小一样调整大小。
这可能吗?
如有任何帮助,我们将不胜感激。
这是我目前所做的:www.nulaena.si/photob/。
最佳答案
是这样的吗?
body {
padding:0;margin:0;
}
#header {
position: absolute;
background: orange;
top:0;
left:0;
width: 100%;
height: 100px;
}
#footer {
position: absolute;
background: orange;
bottom: 0;
left: 0;
width: 100%;
height: 100px;
}
#middle {
position: absolute;
top: 100px;
bottom: 100px;
left: 0;
width: 100%;
}
img {
height:100%;
width: auto;
}
<div id="header">header</div>
<div id="middle">
<img src="images/myImage.jpg" />
</div>
<div id="footer">footer</div>
关于jquery - 将图像调整为 div 的 100% 高度并保持纵横比,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2646740/