如何使Bootstrap Carousel中的图像响应? [英] How to make images in Bootstrap Carousel responsive?

查看:125
本文介绍了如何使Bootstrap Carousel中的图像响应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让bootstrap的传送带内的图像响应一个固定的高度?我已经尝试了一切。我也使用img-responsive,并且在CSS中我也尝试了一切。



这里是我的html

 < div class =item active > 
< div class =container>
< div class =carousel-captionstyle =padding-bottom:90px;>
< h1>全部手提包< / h1>
< p>个性化您的风格< / p>
< p>< a class =btn btn-lg btn-primaryhref =#role =button>查看全部< / a>< / p>
< / div><! - /.carousel-caption - >
< / div><! - /.container - >
< / div><! - /.item - >

< div class =item>
< div class =container>
< div class =carousel-caption>
< div class =caption_background>
< h1>模式化< / h1>
< p>选择您喜欢的< / p>
< / div>
< p>< a class =btn btn-lg btn-primaryhref =#role =button>查看全部< / a>< / p>
< / div><! - /.carousel-caption - >
< / div><! - /.container - >
< / div><! - /.item - >

< / div><! - /.carousel-inner - >

< a class =right carousel-controlhref =#myCarouselrole =buttondata-slide =next>< span class =glyphicon glyphicon-chevron-right> < /跨度>< / A>
< / div><! - /.myCarousel - >

这是我的CSS



http://paste.ubuntu.com/7908633/

解决方案首先,你必须检查Bootstrap提供的工具,特别是网格系统和响应式工具。

Bootstrap 3.2.0 - CSS



然后,为了执行一个良好的响应过程,根据当前屏幕大小,宽度和高度应该都可以调整大小。

另外,你可以在StackOverflow上找到相关的问题,只需要例如:



如何使引导转盘图像响应?

Is there a way to make your images within bootstrap's carousel responsive with a fixed height? I've tried everything. I also used img-responsive, and in the CSS I tried everything as well.

Here's my html

    <div class="item active">
      <img src="images/slide1.jpg" alt="First slide" class="img-responsive">
      <div class="container">
        <div class="carousel-caption" style="padding-bottom:90px;">
          <h1>Totes for all</h1>
          <p>Personalize your style</p>
          <p><a class="btn btn-lg btn-primary" href="#" role="button">View all</a></p>
        </div><!-- /.carousel-caption -->
      </div><!-- /.container -->
    </div><!-- /.item -->

    <div class="item">
      <img src="images/slide2.png" alt="Second slide" class="img-responsive">
      <div class="container">
        <div class="carousel-caption">
          <div class="caption_background">
          <h1>Pattern it</h1>
          <p>Choose your favorite</p>
          </div>
          <p><a class="btn btn-lg btn-primary" href="#" role="button">View all</a></p>
        </div><!-- /.carousel-caption -->
      </div><!-- /.container -->
    </div><!-- /.item -->

  </div><!-- /.carousel-inner -->

  <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
  <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
</div><!-- /.myCarousel -->

Here's my CSS

http://paste.ubuntu.com/7908633/

解决方案

First of all, you have to check the facilities provided by Bootstrap, specifically the grid system and the responsive utilities.

Bootstrap 3.2.0 - CSS

Then, to perform a good responsive procedure, width and height should be both resizable, according to the current screen size.

Furthermore, you could find related questions on StackOverflow, just for instance:

How to make bootstrap carousel image responsive?

这篇关于如何使Bootstrap Carousel中的图像响应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆