当我用纯HTML制作引导旋转木马时,它工作得很好,但当我将代码粘贴到Wordpress中时,旋转木马是完全白色的。
路径没有问题,因为如果我从
<div class="fill" style="background-image:url("img/image01.png");"></div>
至
<img src="img/image01.png" class="img-responsive" alt="">
然后它就起作用了。
我知道这似乎是一个HTML或CSS问题,但我觉得我已经用尽了我能想到的所有选项,这让我觉得这是Wordpress和Bootstrap无法协同工作的原因。我试过换衣服background-image:url 只是background:url 但它仍然是完全白色的。
我也知道如果我在另一个部门尝试,比如:
<section id="schedule">
<div class="row" style="background-image: url(\'img/image01.png\'); margin-top: 75px;">
<div class="callout-light text-center" style="margin-bottom: 30px;">
<h1>Header!</h1>
</div>
</div>
</section>
结果很好。
以下是完整代码:
<style>
.fill {
width: 100%;
height: 100%;
background-position: center;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
}
</style>
<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">
<!-- Set the first background image using inline CSS below. -->
<div class="fill" style="background-image:url(\'img/image01.png\');"></div>
<div class="carousel-caption">
<h2>Caption 1</h2>
</div>
</div>
<div class="item">
<!-- Set the second background image using inline CSS below. -->
<div class="fill" style="background-image:url(\'img/image02.png\');"></div>
<div class="carousel-caption">
<h2>Caption 2</h2>
</div>
</div>
<div class="item">
<!-- Set the third background image using inline CSS below. -->
<div class="fill" style="background-image:url(\'img/image03.png\');"></div>
<div class="carousel-caption">
<h2>Caption 3</h2>
</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>