Bootstrap轮播不是全宽

时间:2017-06-10 17:58:24

标签: javascript jquery html css twitter-bootstrap-3

我正在建立一个网站,我正在使用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>

2 个答案:

答案 0 :(得分:1)

.container替换为.container-fluid

答案 1 :(得分:0)

请在

旁边添加以下课程

720x1280x2.00 10 2 20 320x1152x1.00 8 0 0 480x800x1.00 5 0 0 720x1280x0.00 3 1 33.33 480x854x1.00 3 0 0 720x1184x2.00 2 0 0

您可以根据需要更新高度和宽度。谢谢。