【发布时间】:2013-06-21 20:36:23
【问题描述】:
我正在使用 Bootstrap 创建轮播,我有大图像,所以当屏幕小于图像时,比例不会保持。
我该如何改变呢?
这是我的代码:
.carousel .item {
height: 500px;
}
.carousel img {
position: absolute;
top: 0;
left: 0;
min-width: 100%;
height: 500px;
}
我需要图像适合 100% 的宽度,但保持 500 像素的高度(我认为是 500 像素)这应该意味着在较小的屏幕上我们看不到图像的最左侧和最右侧。
我尝试在 div 中包含图像并添加
overflow: hidden;
width: 100%;
height: 500px;
display: block;
margin: 0 auto;
但它不起作用
谢谢!
【问题讨论】:
标签: html css twitter-bootstrap