html - 如何修复 Bootstrap 轮播上方的空白区域?

标签 html css twitter-bootstrap carousel

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

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

<!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>

最佳答案

删除 <br>从这里开始:

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

关于html - 如何修复 Bootstrap 轮播上方的空白区域?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38391232/

相关文章:

javascript - 复选框颜色变为灰色

HTML & CSS : My image is not appearing?

javascript - 在幻灯片末尾停止 Twitter Bootstrap Carousel

html - 将 Font Awesome 图标与跨度标签内的输入提交垂直对齐

jquery - 模态窗口中的 YouTube 播放器

html - 如何将选定的图像设置为按钮

javascript - 单击按钮时动画导航的边距顶部

html - 热点出现在 IE 中

html - flex 容器的绝对定位子容器不参与 flex 布局,如何使元素居中?

html - 在文本输入字段的右侧放置图标的最佳做法是什么