2017-11-16 4 views
0

せずにウェブサイトからの水平バーを削除します。私は、ページの下部に水平バーがあることに気付きました。私はそれを取り除くことができませんでした。私はstackoverflowで同様の答えを見て、それらのほとんどは、フッターに問題があります。私は私のことをチェックして、まだフッタを設定していないし、100%の幅も持っていない。私が使用したCSSは、ブートストラップ要素のサイズを変更しませんでした。私のHTMLコードに何が間違っているのか分かりますか?は私が応答ウェブサイトを作成するには、ブートストラップフレームを使用していフッター

マイスタイルシート(私は一番下に内容を変更するカルーセルのためのブートストラップが提供するスタイルシートやセクションのdivのIDを使用しています:

CSS

.carousel-inner > .item > img, 
    .carousel-inner > .item > a > img { 
    width: 70%; 
    margin: auto; 
} 

#section { 
    padding-left: 5%; 
} 

HTML

以下は
<div id="container"> 
    <!--Slideshow--> 
    <div class="jumbotron" style="background:transparent !important;"> 
    <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> 
     <li data-target="#myCarousel" data-slide-to="4"></li> 
     </ol> 

     <!-- Wrapper for slides --> 
     <div class="carousel-inner" role="listbox"> 

     <div class="item active"> 
      <img src="Images/Swimming.jpg" alt="1" style="width:460px; height:345px"> 
      <div class="carousel-caption"> 
      <h3>Swimming</h3> 
      <p>Event of Swimming</p> 
      </div> 
     </div> 

     <div class="item"> 
      <img src="Images/Basketball.jpg" alt="2" style="width:460px; height:345px"> 
      <div class="carousel-caption"> 
      <h3>Basketball</h3> 
      <p>Event of Basketball</p> 
      </div> 
     </div> 

     <div class="item"> 
      <img src="Images/Tennis.jpg" alt="3" style="width:460px; height:345px"> 
      <div class="carousel-caption"> 
      <h3>Tennis</h3> 
      <p>Event of Tennis</p> 
      </div> 
     </div> 

     <div class="item"> 
      <img src="Images/Football.jpg" alt="4" width="460" height="345"> 
      <div class="carousel-caption"> 
      <h3>Football</h3> 
      <p>Event of Football</p> 
      </div> 
     </div> 

     <div class="item"> 
      <img src="Images/Baseball.jpg" alt="5" width="460" height="345"> 
      <div class="carousel-caption"> 
      <h3>Baseball</h3> 
      <p>Event of Baseball</p> 
      </div> 
     </div> 
     </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> 

    <br> 


    <div class="row"> 
    <div class="col-sm-12 col-md-4" id="section"> 
     <h3>Registration for 2018</h3> 
     <div id="registration" style="font-size: 20px;"> 
     <p>Click <a href="#">here</a> to Register 
      <br /> Click <a href="#">here</a> to Register</p> 
     </div> 
    </div> 
    <div class="col-sm-12 col-md-4" id="section"> 
     <h3>Announcements</h3> 
     <p>s to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one 
     of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum 
     et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in 
     section 1.10.32. 
     </p> 
    </div> 
    <div class="col-sm-12 col-md-4" id="section"> 
     <h3>Facebook Feed</h3> 
     <p>The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English 
     versions from the 1914 translation by H. Rackham. 
     </p> 
    </div> 
    </div> 
</div> 

水平BAとの私のウェブサイトの写真ですr: Picture of my website with Horizontal Bar

私はこれが間違っていることを学ぶことができますように願っています。不要な水平スクロールバーの

+1

を更新し、各セクションを削除します。そうすれば、問題の要素が何であるかを知ることができます。 – Swellar

+0

@ Swellarの提案は、ページの幅が広すぎる部分を見つける良い方法です。望ましくない水平スクロールバーの1つの典型的な原因は、要素をビューポートの端に引っ張るために要素に左右の余白を負に設定することです。マージンは画面を越えて伸び、スクロールバーを強制します。これは、包含する要素にoverflow:hiddenを設定することで解決できます。 –

+0

@ジョナサンニコルこんにちは卿、私は氏膨潤が言ったことをしようとしたジャンボトロンを削除し、問題が解決しません。次に、行の下部を削除しようとしましたが、もう水平バーはありません。私はオンラインでチェックし、ブートストラップによって提供される.rowには-15pxのマージンがあると言いました。あなたはそれを解決する方法を知っていますか? – Azvier

答えて

1

一つの典型的な原因は、ビューポートの端にそれをプルする要素にマイナス右/左余白を設定しています。マージンは画面を越えて伸び、スクロールバーを強制します。

ブートストラップは、あなたのケースでは、水平スクロールバーの原因となっている、.rowの左右に-15px余白を適用します。

ブートストラップの.rowは、.containerの内部で使用されるように設計されています。これは、負のマージンを補うために左右の埋め込みがあります。あなたは含むdiv要素を持っていますが、ブートストラップは、それをスタイリングされていないので、「コンテナ」、ないclassidを持っています。それに.containerクラスを追加します。あなたは.containerのパディング望ましくないを見つけた場合

<div id="container" class="container"> 

、あなたの代わりにカスタムCSSルールとのオーバーフローを隠すことができます:

#container { 
    overflow: hidden; 
} 
+0

ありがとうございます。それでは、.row要素を.containerの中にラップする必要があるということですか?コンテナを別の.container(私はそれを.jumbotronの上で使った)の中にラップするべきではないことを確認しました。この場合、コンテナ流体で代用することは可能ですか? – Azvier

+0

実際には現在、あなたのマークアップに.containerはありません。ラッピング要素には、クラス "container"ではなく、 "container"というIDがあります。 おそらくあなたが望むのはaです。コンテナ流体包装Jumbotronと通常のコンテナラッピング。 –

+0

Jumbotron(既にパッディングが適用されています)と.rowtain用の.containerまたは.container-fluidラッパーのラッパーはありません。 –

関連する問題