【问题标题】:How to constant background image in bootstrap slider?如何在引导滑块中保持背景图像不变?
【发布时间】:2016-09-23 19:48:22
【问题描述】:

我正在使用引导滑块(https://blackrockdigital.github.io/startbootstrap-full-slider/),我必须使用恒定的背景图片。我想在背景中只使用一张图片,这样只有内容会滑动。你们可以查看链接,因为背景中有 3 张图片(第一张,第二张,第三张)。我只需要使用一张图片。你能帮我吗?

【问题讨论】:

  • 请仔细检查html代码。这是一个外观。
    placehold.it/1900x1080&text=SlideOne');">如果你随意改变“Slide One”,图片的文字只会自动改变。
  • 感谢Josef先生的回复,没问题,我会添加其他图片。我仅举个例子。
  • 太好了。没问题。
  • 您可以通过以下链接了解更多信息Only One Image In Bootstrap Carousel to Slide
  • 感谢 Tamilmani 先生的回复,这是不同的问题。我只需要显示一张图片。点击后只有内容会滑动。

标签: jquery html twitter-bootstrap css background-image


【解决方案1】:

使用下面的代码

Css
    .carousel-inner {
        height: 100%;
            background-image:url('http://placehold.it/300?text=placehold');
    }

HTML
<!-- Wrapper for Slides -->
        <div class="carousel-inner">
            <div class="item active">
                <!-- Set the first background image using inline CSS below. -->
                <div class="fill" style="font-size: 32px;text-align: center;padding-top: 100px;">Slide 1</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="font-size: 32px;text-align: center;padding-top: 100px;">Slide 2</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="font-size: 32px;text-align: center;padding-top: 100px;">Slide 3</div>
                <div class="carousel-caption">
                    <h2>Caption 3</h2>
                </div>
            </div>
        </div>

【讨论】:

  • 感谢 Mohamed 先生的回复。它正在工作,但背景图像的高度存在一些问题...
  • 我的图片高度是 500px,更改背景图片后显示几乎 100px
  • 请分享您的原始链接,我会检查身高问题。
  • 酷!!!!我添加了填充并且工作得很好......谢谢Mr.Mohamed。非常感谢你。
猜你喜欢
相关资源
最近更新 更多
热门标签