显示来自CSS的旋转木马

时间:2019-03-17 20:30:11

标签: html css bootstrap-4

这里,我有一个HTML结构的轮播。但是当我编译时没有任何显示,

<div class="list-offers">
  <div class="container">
   <div class="row1">
    <div class="col-xs-12 item bg_fix right" style="background-image: url(&quot;./images/bottom.jpg&quot;);">
     <img class="foto" alt="Beach" title="Beach" itemprop="image" src="./images/bottom.jpg" style="display: none;">
     <div class="col-xs-12 item ">
      <div data-ride="carousel" class="carousel slide" id="myCarousel2">
       <div class="carousel-inner">
        <div class="item  noimage">
         <h4 itemprop="name">¡consectetuer adipiscing elit!</h4>
         <p itemprop="description">Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>
       </div>
       <div class="item   noimage active">
         <h4 itemprop="name">¡consectetuer adipiscing elit!</h4>
         <p itemprop="description">Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>
       </div>
       <div class="item   noimage">
         <h4 itemprop="name">consectetuer adipiscing elit!</h4>
         <p itemprop="description">Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>
       </div>
     </div>
     <ol class="carousel-indicators">
      <li class="" data-slide-to="0" data-target="#myCarousel2"></li>
      <li data-slide-to="1" data-target="#myCarousel2" class="active"></li>
      <li data-slide-to="2" data-target="#myCarousel2" class=""></li>
    </ol>
  </div>
</div>
</div>
</div>
</div>
</div>

那么,为了显示它,我必须在CSS中添加什么?有什么建议吗?

我已经尝试过了,但是没有用:我已经修改了css,因为这个想法只是修改了css

.carousel-inner {
    position: relative !important;
    background-color: aqua !important;
    width: 100%;
    height: 285px !important;
    border: 3px solid #73AD21;
}

.noimage {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 480px;
    height: 10px !important;
    background-color: blue;
}

1 个答案:

答案 0 :(得分:0)

对轮播使用以下代码显示文字,表明您尚未使用标题标记

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
  <style>
  .carousel-inner > .item > img,
  .carousel-inner > .item > a > img {
    width: 70%;
    margin: auto;
  }
  </style>
</head>
<body>

<div class="container">

  <div id="myCarousel" class="carousel slide" data-ride="carousel">
    <!-- 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>
      <li data-target="#myCarousel" data-slide-to="3"></li>
    </ol>

    <!-- Wrapper for slides -->
    <div class="carousel-inner" role="listbox">

      <div class="item active">
        <img src="//via.placeholder.com/1200x400" alt="avatar" width="460" height="345">
        <div class="carousel-caption">
          <h3>Chania</h3>
          <p>The atmosphere in Chania has a touch of Florence and Venice.</p>
        </div>
      </div>

      <div class="item">
        <img src="//via.placeholder.com/1200x400" alt="avatar" width="460" height="345">
        <div class="carousel-caption">
          <h3>Chania</h3>
          <p>The atmosphere in Chania has a touch of Florence and Venice.</p>
        </div>
      </div>

      <div class="item">
        <img src="//via.placeholder.com/1200x400" alt="avatar" width="460" height="345">
        <div class="carousel-caption">
          <h3>Flowers</h3>
          <p>Beautiful flowers in Kolymbari, Crete.</p>
        </div>
      </div>

      <div class="item">
        <img src="//via.placeholder.com/1200x400" alt="avatar" width="460" height="345">
        <div class="carousel-caption">
          <h3>Flowers</h3>
          <p>Beautiful flowers in Kolymbari, Crete.</p>
        </div>
      </div>

    </div>

    <!-- Left and right controls -->
    <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
      <span class="fa fa-angle-left" aria-hidden="true"></span>
      <span class="sr-only">Previous</span>
    </a>
    <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
      <span class="fa fa-angle-right" aria-hidden="true"></span>
      <span class="sr-only">Next</span>
    </a>
  </div>
</div>
  <style>
  .carousel-inner > .item > img,
  .carousel-inner > .item > a > img {
    width: 70%;
    margin: auto;
  }
  </style>
</body>
</html>