Bootstrap 3.3.7 “row” causing horizontal scroll bar

后端 未结 5 1485
星月不相逢
星月不相逢 2021-01-11 13:29

Ok ok, I know. This question has been asked a lot. But, so far, I have not found a working solution. I boiled my page down to nothing but this:

相关标签:
5条回答
  • 2021-01-11 13:52

    First of all you don't need row or col-*12 classes if your section is 100% wide look at this bootstrap example they have not taken any row or col-*12 neither with header nor jumbotron. If your section has column Just take row inside col-* classes for example

    <div class="col-sm-6">
        <div class="row">stuff</div>
    </div>
    <div class="col-sm-6">
        <div class="row">stuff</div>
    </div>
    

    Fiddle

    Or in case if you are using container-fluid

    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-6">
                <div class="row">stuff</div>
            </div>
            <div class="col-sm-6">
                <div class="row">stuff</div>
            </div>
        </div>
    </div>
    

    Fiddle

    0 讨论(0)
  • 2021-01-11 14:01

    Why dont you use a container-fluid and completely remove the margin ?

    <div class="container-fluid" style="margin: 0">
       <div class="row">
          <div class="col-md-6">
    
          </div>
          <div class="col-md-6">
    
          </div>
       </div>
    </div>
    

    Or make your own div around it with width: 100%

    0 讨论(0)
  • 2021-01-11 14:02

    An easier way is to simply remove the margins on the offending row(s):

    .row {
        margin-left: 0px;
        margin-right: 0px;
    }
    
    0 讨论(0)
  • 2021-01-11 14:08

    Are you talking about a scrollbar appearing on the bottom of the page when the container is supposed to be fluid? There might be an element in your page that is extending the width of the screen.

    I usually use this Chrome extension to see what CSS elements are extending farther than they should.

    Also, see if this Fiddle helps (code below).

    <div class="container-fluid">
     <div class="row">
      <div class="col-sm-12">
    Lorem Ipsum is simply dummied text of the printing and typesetting industry.
      </div>
     </div>
    </div>
    
    0 讨论(0)
  • 2021-01-11 14:15

    If someone is facing this in Bootstrap v4. Just add m-0 to your div.

    <div class="row m-0"></div>
    
    0 讨论(0)
提交回复
热议问题