如何删除轮播左侧和右侧的空白区域

时间:2019-02-11 09:59:59

标签: html carousel

我尝试使用发现的不同答案删除轮播左侧和右侧的多余空白,但未成功。我正在从这里使用示例:https://www.w3schools.com/bootstrap/bootstrap_carousel.asp 如何删除该空间并只留下轮播?

(arr as typeof a[]).push(a);

1 个答案:

答案 0 :(得分:0)

删除此容器<div class="container">

<!DOCTYPE html>
    <html lang="en">
    <head>
      <title>Carousel</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 img {
          width: 100%;
          height: 100%;
      }
    
      </style>
    </head>
    <body>
    
    
      
      <div id="myCarousel" class="carousel slide" data-interval="false" 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">
          <div class="item active">
            <img src="begin.png" alt="" style="width:100%;">
          </div>
    
          <div class="item">
            <img src="first.png" alt="" style="width:100%;">
          </div>
        
          <div class="item">
            <img src="second.png" alt="" style="width:100%;">
          </div>
    
          <div class="item">
            <img src="third.png" alt="" style="width:100%;">
          </div>
        </div>
    
        <!-- Left and right controls -->
        <a class="left carousel-control" href="#myCarousel" data-slide="prev">
          <span class="glyphicon glyphicon-chevron-left"></span>
          <span class="sr-only">Previous</span>
        </a>
        <a class="right carousel-control" href="#myCarousel" data-slide="next">
          <span class="glyphicon glyphicon-chevron-right"></span>
          <span class="sr-only">Next</span>
        </a>
      </div>
    
    
    </body>
    </html>