【问题标题】:How to fix the white space above Bootstrap carousel?如何修复 Bootstrap 轮播上方的空白?
【发布时间】:2016-07-15 16:22:23
【问题描述】:

如何删除轮播上方的空白区域?我已经尝试了所有我能想到的方法,但没有成功。

我想要一个带有透明/白色背景图像的彩色背景。所以旋转木马的背景颜色必须是白色,但是当我添加它时,它会将白色条添加到旋转木马的顶部。

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

<div style="background-color: white; padding: 0px;" class="container">
  <br>
  <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="https://pixabay.com/static/uploads/photo/2014/06/03/19/38/road-sign-361514_960_720.png">
      </div>

      <div class="item">
        <img src="https://pixabay.com/static/uploads/photo/2014/06/03/19/38/road-sign-361514_960_720.png">
      </div>

    <!-- Left and right controls -->
    <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
      <span class="glyphicon glyphicon-chevron-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="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
      <span class="sr-only">Next</span>
    </a>
  </div>
</div>
</body>
</html>

【问题讨论】:

    标签: html css twitter-bootstrap carousel


    【解决方案1】:

    从这里删除&lt;br&gt;

    <div style="background-color: white; padding: 0px;" class="container">
      <br>
      <div id="myCarousel" class="carousel slide" data-ride="carousel">
    

    【讨论】:

    • 很高兴我能帮上忙!
    猜你喜欢
    • 2019-08-18
    • 1970-01-01
    • 2020-07-31
    • 2014-07-10
    • 1970-01-01
    • 2016-10-15
    • 1970-01-01
    • 2017-09-22
    • 2015-01-20
    相关资源
    最近更新 更多