我正在寻找使用bootstrap创建轮播。我希望图像(具有不同的宽度和高度)以固定的比例显示,。我尝试使用CSS的所有内容都会中断并且图像比率会中断并继承传送带的大小。Twitter Bootstrap旋转木马图像比例
CSS
.carousel .item > img {
position: absolute;
top: 0;
left: 0;
min-width: 100%;
height: 702px;
max-width: none;
}
html代码:
<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
<div class="active item">
<img src="image1.jpg"/>
</div>
<div class="item">
<img src="image1.jpg"/>
</div>
</div>
</div>
我应该寻找,保持图像的比或有解决方法的另一个旋转木马的解决方案?
编辑1:
.carousel .item > img {
max-width: 100%;
height: 100%;
width: auto;
text-align: center;
margin: 0 auto;
}
你是什么意思是什么呢?你想将图像拉伸到容器大小还是只填充宽度? –