I have markup similar to this:
<div class="container-fluid">
<div class="container">
<div class="row">
<h1>Hello World!</h1>
</div>
</div>
</div>
Obviously, I want the .container-fluid
to span the entire width of the screen. However, in smaller screen widths, it doesn't seem to do that. There appears a space on both sides of the screen, thus reducing the amount of screen real estate and affecting the overall look and feel I'm trying to achieve.
Is there a way to get rid of this space? I want .container-fluid
to span the entire width of the screen regardless of the screen width.
Additionally, Bootstrap also includes an .mx-auto class for horizontally centering fixed-width block level content—that is, content that has display: block and a width set—by setting the horizontal margins to auto . Centered element.
I had the same problem using Bootstrap 3.0. Solved it for small screens by putting:
.container {
padding-right: 0; /*15px in bootstrap.css*/
padding-left: 0; /*idem*/
margin-right: auto;
margin-left: auto;
}
in my own stylesheet.
Just add class 'p-0' beside 'container-fluid' class because in bootstrap padding:0 is already defined.
<div class="container-fluid p-0">Content goes here</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With