2
以下類別爲slide
的元素應在CSS中保持由padding-bottom:44%;
控制的固定高寬比。內部元素(帶有類slide
的圖像)應裁剪以適應盒子,同時縮放至100%寬度。在IE,Chrome,Safari中顯示的位置絕對不可見的IMG - 爲什麼?
現在我的問題是,這在Chrome瀏覽器,Safari瀏覽器,甚至IE瀏覽器工作正常,但在Firefox它根本不會顯示。這是爲什麼?
我的HTML:
<header class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">
<img class="slide" src="https://cranmoremtlodge.files.wordpress.com/2008/09/fall-foliage-003.jpg" />
</div>
</header>
我的CSS:
/*these two are mine*/
.swiper-slide {
width: 1664px; /*assigned as element style by swiper*/
position:relative;
padding-bottom:44%;
overflow: hidden;
}
.swiper-slide .slide {
position:absolute;
top:-50%; bottom:-50%;
margin:auto;
width: 100%;
height: auto;
background: teal;
}
/*these three come with www.idangero.us/swiper/ */
.swiper-wrapper {
box-sizing: content-box;
display: flex;
height: 100%;
position: relative;
transition-property: transform;
width: 100%;
z-index: 1;
}
.swiper-container {
margin: 0 auto;
overflow: hidden;
position: relative;
z-index: 1;
}
.swiper-slide {
flex-shrink: 0;
height: 100%;
}
小提琴:https://jsfiddle.net/smauo1wu/5/
非常感謝。漫長的一天... –