CSS背景 - 图像缩小

时间:2017-05-23 18:10:23

标签: html css twitter-bootstrap

我正在使用4个图像的bootstrap轮播滑块,最后2个图像完全吻合,前2个不合适,它们在顶部被切断,前两个图像是4000 x 3000,最后两个是4000 x 2000.是否可以缩小背景图像?我正在使用背景大小:封面和我的前两张图片被截断,是否有人对我应该做什么有任何建议?

.fill { width: 100%;  height: 100%; background-position: center; background-size: cover; }


<header id="myCarousel" class="carousel slide">
                <!-- Indicators -->
                <ol class="carousel-indicators">
                    <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
                    <li data-target="#myCarousel" data-slide-to="1"></li>
                    <li data-target="#myCarousel" data-slide-to="2"></li>
                    <li data-target="#myCarousel" data-slide-to="3"></li>
                </ol>

                <!-- Wrapper for Slides -->
                <div class="carousel-inner">
                    <div class="item active">
                        <!-- Set the first background image using inline CSS below. -->
                        <div class="fill" style="background-image:url('/Images/banner-images/slider-1.jpg?v=4789372489');"></div>
                    </div>
                    <div class="item">
                        <!-- Set the second background image using inline CSS below. -->
                        <div class="fill" style="background-image:url('/Images/banner-images/slider-2.jpg?v=4789372489');"></div>
                    </div>
                    <div class="item">
                        <!-- Set the third background image using inline CSS below. -->
                        <div class="fill" style="background-image:url('/Images/banner-images/slider-3.jpg?v=4789372489');"></div>
                    </div>
                    <div class="item">
                        <!-- Set the third background image using inline CSS below. -->
                        <div class="fill" style="background-image:url('/Images/banner-images/slider-4.jpg?v=4789372489');"></div>
                    </div>
                </div>

                <!-- Controls -->
                <a class="left carousel-control" href="#myCarousel" data-slide="prev">
                    <span class="icon-prev"></span>
                </a>
                <a class="right carousel-control" href="#myCarousel" data-slide="next">
                    <span class="icon-next"></span>
                </a>

            </header>



.carousel {
    height: 600px;
}

@media (min-width: 768px) {

    .carousel {
        height: 75vh;
    }
}

0 个答案:

没有答案