好吧,我已經在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
。我認爲它會引起一些頭痛,但以及...