自引导旋转木马的分辨率和宽高比图像大小



我想让我的bootstrap carousel占用用户进入我的网站的整个页面。然而,由于显示器之间的宽高比和分辨率存在差异,我想知道解决这个问题的最佳方法是什么?

我认为我应该首先选择相对相同大小的图像开始。这是我目前掌握的信息。

css:

img {
    background-size: cover;
    background-position: center center;
    background-repeat:no-repeat;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

如果我使用的图像具有超高分辨率怎么办?这将不适合用户的页面吗?

我相信这将工作,但我不能确定。但是你可以在这里看到:

http://jsfiddle.net/heyallanmoreno/7tdvu/4/

     <section class="block">
    <div id="myCarousel" class="carousel slide">
        <div class="carousel-inner">
            <div class="active item">
                <img src="http://lorempixel.com/1024/750" alt="Slide1" />
            </div>
            <div class="item">
                <img src="http://lorempixel.com/1024/750" alt="Slide2" />
            </div>
            <div class="item">
                <img src="http://lorempixel.com/1024/750" alt="Slide3" />
            </div>
        </div>
        <a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a>
 <a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>
    </div>
</section>

.carousel .item {
    width: 100%; /*slider width*/
    max-height: 600px; /*slider height*/
}
.carousel .item img {
    width: 100%; /*img width*/
}
/*add some makeup*/
.carousel .carousel-control {
    background: none;
    border: none;
    top: 50%;
}
/*full width container*/
@media (max-width: 767px) {
    .block {
        margin-left: -20px;
        margin-right: -20px;
    }
}

最新更新