好吧,我已经在this answer的帮助下解决了这个问题。
底线是,我推<img>
ES到CSS背景为每个.carousel .item
和应用以下csses:
.carousel .item {
background-position: center center;
background-repeat: no-repeat;
/* background-size: cover; */ /* I don't wanna (up|down)scale */
height: 510px; /* fixed height of the background images */
}
#carousel-item-1 {
background-image: url(myImage.jpg);
}
#carousel-item-2 {
background-image: url(myImage.jpg);
}
#carousel-item-3 {
background-image: url(myImage.jpg);
}
一个愉快的副作用是,它也中心水平和垂直方向的图像(作物他们),我也需要。
我认为这样做是正确的做法,我应该从一开始就使用它。但我并不喜欢固定的,手写的height: 510px
。我认为它会引起一些头痛,但以及...