如何删除留下的空白和轮播权

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何删除留下的空白和轮播权相关的知识,希望对你有一定的参考价值。

我试图删除使用不同的答案,我发现左,右旋转木马的多余的空白,但我没有成功。我使用从这里的例子:https://www.w3schools.com/bootstrap/bootstrap_carousel.asp如何删除空间,只留下了旋转木马?

<!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 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">
          <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>
    </div>
    
    </body>
    </html>
答案

删除此容器<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>

以上是关于如何删除留下的空白和轮播权的主要内容,如果未能解决你的问题,请参考以下文章

02微信小程序-轮播的宽度100%显示和轮播的基础配置

焦点控制切换和轮播

简单说说tab标签页和轮播图

点击锚点和轮播控件正在关闭模式

Android侧滑菜单和轮播图之滑动冲突

Jquery实现动态导航栏和轮播导航栏