I'm trying to create some "horizontal bands" in a Bootstrap 3 CSS layout, extending to the whole size of the browser's window, and thus outside of the content class margins. Here is a Plunker: http://plnkr.co/edit/6SlNU0ZgFehrBD64r9FG . I found that I can accomplish this by using a container-fluid
class: this implies having a div with that class including other div's, some representing my "bands", and others just using the container
class. Thus, my relevant CSS is:
div.band {
width: 100% !important;
background-color: #D7EAD8;
color: #323F3F;
}
and my HTML:
<div class="container-fluid">
<div class="row band">Hello band</div>
<div class="container">
<div class="row">...</div>
</div>
<div class="row band">Another band</div>
<div class="container">
<div class="row">...</div>
</div>
</div>
Yet, this does not fully work as I keep getting some white margin at the right edge of the "band" div. I don't know Bootstrap internals and surely I'm doing something wrong, could anyone suggest a solution to make the "band" full-width?
In these cases, I set up the page containers in a per-block manner like this:
div.band {
background-color: #D7EAD8;
color: #323F3F;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<div class="band">
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
Column content here
</div>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
Regular usage of Bootstrap
</div>
</div>
</div>
You don't need the width on .band
in this way.
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