Javascript 如何使旋转木马占据整个页面宽度

Javascript 如何使旋转木马占据整个页面宽度,javascript,jquery,css,twitter-bootstrap,carousel,Javascript,Jquery,Css,Twitter Bootstrap,Carousel,我从以下链接下载了旋转木马代码:查看源: 我设法让它在一个简单的html页面中工作。但是,当我将代码复制/粘贴到我的网站页面中时,我的两侧都有一个间隙,即旋转木马不会占据页面的整个宽度 我曾尝试在css中添加高度:100%,宽度100%,但没有效果 下面的代码在自己的页面中运行良好,但一旦添加到页面的其他元素,即导航和文本,即出现间距问题时 <!-- Full Page Image Background Carousel Header --> <header id="myCar

我从以下链接下载了旋转木马代码:查看源:

我设法让它在一个简单的html页面中工作。但是,当我将代码复制/粘贴到我的网站页面中时,我的两侧都有一个间隙,即旋转木马不会占据页面的整个宽度

我曾尝试在css中添加高度:100%,宽度100%,但没有效果

下面的代码在自己的页面中运行良好,但一旦添加到页面的其他元素,即导航和文本,即出现间距问题时

<!-- Full Page Image Background Carousel Header -->
<header id="myCarousel" class="carousel slide">
   <!-- 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">
         <!-- Set the first background image using inline CSS below. -->
         <div class="fill"><img src="images/index1.jpg" img class="img-responsive center-block" width = "100%"></div>
         <div class="carousel-caption">
            <h2>#bebrown</h2>
         </div>
      </div>
      <div class="item">
         <!-- Set the second background image using inline CSS below. -->
         <div class="fill"><img src="images/index1.jpg" img class="img-responsive center-block" width = "100%"></div>
         <div class="carousel-caption">
            <h2>Caption 2</h2>
         </div>
      </div>
      <div class="item">
         <!-- Set the third background image using inline CSS below. -->
         <div class="fill"><img src="images/index1.jpg" img class="img-responsive center-block" width = "100%"></div>
         <div class="carousel-caption">
            <h2>Caption 3</h2>
         </div>
      </div>
   </div>
   <!-- Controls -->
   <a class="left carousel-control" href="#myCarousel" data-slide="prev">
   <span class="icon-prev"></span>
   </a>
   <a class="right carousel-control" href="#myCarousel" data-slide="next">
   <span class="icon-next"></span>
   </a>
</header>
<!-- /.container -->

  • #贝布朗 标题2 标题3
    确保文档中包含以下内容,并且doctype为HTML5

      *{
         box-sizing: border-box;
         /*add the other browsers here too*/
       }
    
       html, body{
          padding: 0;
          margin: 0;
       }
    
    然后将明显的图像宽度:100%等


    请参见

    您的网站是否处于活动状态?如果是,请提供链接,或者请尝试在
    jsfiddle
    中复制问题,因为这基本上是
    CSS
    问题。谢谢Gurupasad。这里是链接。任何反馈都会非常有用。请参阅您在
    custom.css
    第7行中对正文应用了
    padding:30px
    。。将其更改为
    padding:0px
    或将其删除。。此外,您还将您的旋转木马包装在一个
    div
    中,该div具有内联样式,左侧为
    填充:15px删除此项,一切正常..你是一个天才Gurupasad!成功了!非常感谢你!真的很感激!!!随时快乐编码…)