Reputation: 53
I want to make a full width web page by Bootstrap 4.
I try to remove the original 15px padding of container-fluid, but it is still not working.
Details on jsfiddle. I marked the whole background as purple but u can see the jumbotron is not fully cover on the purple background.
<style>
.container-fluid {
padding: 0 !important;
}
</style>
Upvotes: 3
Views: 8802
Reputation: 61
We can use the following to get rid of the purple space
.container-fluid {
padding-left: 0;
padding-right: 0;
}
.jumbotron {
margin: 0;
}
However, https://stackoverflow.com/a/50389225/4513747 provides a more elegant solution using the existing classes.
Upvotes: 0
Reputation: 49
Adding the class container-full-width
worked for me.
<div class="container-full-width">
<div class=" row ">
<div class="col-12">
Upvotes: 1
Reputation: 63
<div class="container-fluid px-0">
<div class="row">
<div class="col-12">
your-content-goes-here
</div>
</div>
</div>
https://getbootstrap.com/docs/4.1/utilities/spacing/#examples
Upvotes: 5
Reputation: 362350
Just use the p-0
and m-0
utility classes on the col and jumbotron (no extra CSS needed)...
<div class="container-fluid">
<div class="row">
<div class="col-md-12 p-0" style="background: purple;">
<div class="jumbotron m-0">
<h2>
Hello, world!
</h2>
<p>
This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.
</p>
<p>
<a class="btn btn-primary btn-large" href="#">Learn more</a>
</p>
</div>
</div>
</div>
</div>
https://www.codeply.com/go/iAQiRARTFR
Upvotes: 6