在完整的滑块引导程序中的图像背景

时间:2017-01-06 15:37:15

标签: css twitter-bootstrap

我正在使用Full Slider引导程序here,当我用文件夹中的图像替换图像URL时,它不起作用。

image:url('http://placehold.it/1900x1080&... One') 

通过

<img class="fill" src="background:url(./img/header.jpg)"></img>

在bootstrap页面上,即使我尝试了不同的解决方案../img或/ img,一些人也遇到了同样的问题,但它不起作用。

有人有想法吗?

谢谢

这是Bootstrap的源代码,我改了

                <div class="fill" style="background-image:url('http://placehold.it/1900x1080&text=Slide One');"></div> 

通过

<div class="fill" src="img/header.jpg"></div>  

&#13;
&#13;
    <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=""></div>
                <div class="fill" src="img/header.jpg"></div>
                <div class="carousel-caption">
                    <h2>Caption 1</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>
&#13;
&#13;
&#13;

2 个答案:

答案 0 :(得分:2)

让它在本地工作:

<div class="fill" style="background-image: url('img/picture.jpg')"></div>

在包装器DIV中

<!-- 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/picture.jpg')"></div>
        <div class="carousel-caption">
        <h2>Caption 1</h2>
   </div>
</div>

答案 1 :(得分:1)

试试这个。 src =“img / header.jpg”