twitter-bootstrap – Twitter Bootstrap Carousel图像标题的定位和样式

前端之家收集整理的这篇文章主要介绍了twitter-bootstrap – Twitter Bootstrap Carousel图像标题的定位和样式前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想在Twitter Bootstrap网站上改变Carousel的位置.我想要的是将图片放在图像的中间(中心从顶部和左侧对齐).它现在正对齐底部.

代码如下: –

<div id="myCarousel" class="carousel slide">
    <div class="carousel-inner">
      <div class="item active" id="home-carousel-inner">
        <img src="media/39440/CHI-3-4-2048x1152-v31931.jpg" alt="">
         <div class="container">
          <div class="carousel-caption">
            <h1>Another dsdaf headline.</h1>
            <p class="lead">Cras justo odio,dapibus ac facilisis in,egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
            <a class="btn btn-large btn-primary" href="#">Learn more</a>
          </div>
        </div>

      </div>
      <div class="item">
        <img src="media/39468/CIH-1-2048x1152-v31931.jpg" alt="">
        <div class="container">
          <div class="carousel-caption">
            <h1>Another example headline.</h1>
            <p class="lead">Cras justo odio,egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
            <a class="btn btn-large btn-primary" href="#">Learn more</a>
          </div>
        </div>
      </div>
      <div class="item">
        <img src="media/32602/CIH-2-2048x1152-1931.jpg" alt="">
        <div class="container">
          <div class="carousel-caption">
            <h1>One more for good measure.</h1>
            <p class="lead">Cras justo odio,egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
            <a class="btn btn-large btn-primary" href="#">Browse gallery</a>
          </div>
        </div>
      </div>
    </div>
    <a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a>
    <a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a>

这是这样的……

现在,它看起来像这样: –

解决方法

你可以自定义Bootstrap .carousel-caption CSS ..
.carousel-caption {
      max-width: 550px;
      padding: 0 20px;
      margin:0 auto;
      margin-top: 200px;
      text-align:center;
}

这是一个Bootply来演示

原文链接:https://www.f2er.com/bootstrap/234141.html

猜你在找的Bootstrap相关文章