引导轮播不是全宽

引导轮播不是全宽

我正在建立一个网站,而我正在与Bootstraps Carousel奋斗,它没有填满屏幕的整个宽度。
有谁知道如何解决这一问题
谢谢你的回答
(顺便说一句,代码中有些东西还没有使用)



body
{
background-color: black;
}
#Haupt
{
  color: yellow;
    align-content: center;
}

.header1
{

}
h1
{
}
/* The navigation bar */
.navbar {
    overflow: hidden;
    background-color: #333;
    position: fixed; /* Set the navbar to fixed position */
    top: 0; /* Position the navbar at the top of the page */

    width: 100%; /* Full width */
}

/* Links inside the navbar */
.navbar a {

    display: block;
    color: #f2f2f2;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
}

/* Main content */
.main {
    margin-top: 30px; /* Add a top margin to avoid content overlay */
}
h1:hover
{
    background-color: dimgray;
}

 .tales {
  width: 100%;
}
.carousel-inner{
  width:100%;
  max-height: 200px !important;
}
   

<!DOCTYPE html>
<html lang="en">
<head>
<style>
body {margin:0;}

.navbar {
  overflow: hidden;
  background-color: #333;
  position: fixed;
  top: 0;
  width: 100%;
}

.navbar a {
  float: left;
  display: block;
  color: #f2f2f2;
  padding: 14px 16px;
  text-decoration: none;
  font-size: 17px;
}

.main {
  padding: 16px;
  margin-top: 30px;
  height: 1500px; /* Used in this example to enable scrolling */
}

</style>
  <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.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>

<div class="navbar">
  <a  href="#home">Home</a>
  <a  href="#news">News</a>
  <a  href="#contact">Contact</a>
  <a  href="#about">About</a>

</div>




<div class="container">
  <h2>Carousel Example</h2>
  <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>
    </ol>

    <!-- Wrapper for slides -->
    <div class="carousel-inner">
      <div class="item active">
        <img src="Bild1.jpg" alt="Pic1" width = "100%">
      </div>

      <div class="item">
        <img src="Bild2.jpg" alt="Pic2" width = "100%">
      </div>

      <div class="item">
        <img src="Bild3.jpg" alt="Pic3" 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>

最佳答案

.container替换为.container-fluid

关于javascript - 引导轮播不是全宽,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44476420/

10-11 11:22