一些括号内容没有显示

时间:2016-05-17 11:46:38

标签: html css adobe-brackets

我有一个问题,我的一些背景图像显示在实时预览中,但通过Chrome浏览器本身查看时,我的背景图像不会显示。以下是一些未显示图像的代码:

<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>
    </ol>

    <!-- Wrapper for slides -->
    <div class="carousel-inner">
        <div class="item active">
            <div class="fill" style="background-image:url(../pictures/s1.jpg);"></div>

        </div>
        <div class="item">
            <div class="fill" style="background-image:url(../pictures/s2.jpg);"></div>

        </div>
        <div class="item">
            <div class="fill" style="background-image:url(../pictures/s3.jpg);"></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>

1 个答案:

答案 0 :(得分:0)

这是最简单的方法:

 <div class="carousel-inner">
    <div class="active item"><img src="assets/img/slide1.jpg" alt="" /></div>
    <div class="item"><img src="assets/img/slide2.jpg" alt="" /></div>
    <div class="item"><img src="assets/img/slide3.jpg" alt="" /></div>
  </div>

如果您想使用background-image属性,那么您应该尝试:

<div class="carousel-inner">
        <div class="active item one"></div>
        <div class="item two"></div>
        <div class="item three"></div>
</div>

CSS:

.carousel .item {
    position: fixed; 
    width: 100%; height: 100%;
    -webkit-transition: opacity 1s;
    -moz-transition: opacity 1s;
    -ms-transition: opacity 1s;
    -o-transition: opacity 1s;
    transition: opacity 1s;

}
.carousel .one {
    background: url(../pictures/s1.jpg);
    background-size: cover;
    -moz-background-size: cover;
}
.carousel .two {
    background: url(../pictures/s2.jpg);
    background-size: cover;
    -moz-background-size: cover;
}
.carousel .three {
    background: url(../pictures/s3.jpg);
    background-size: cover;
    -moz-background-size: cover;
}