Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap: fluid layout with no external margin

if i have:

<div class="container-fluid">    <div class="row-fluid">       <div class="span8">              Some Element....        </div>        <div class="span4">              Other Element        </div>       </div>        </div> 

With this code i have some margin from left and right window borders. How can eliminate these margins?

Thanks for your support

like image 395
Tom Avatar asked Jan 18 '13 14:01

Tom


People also ask

How do I remove margins in Bootstrap?

So the answer is: . container-fluid > . row -- make the margin:0 on the left and right if you remove the padding on the left and right of the column classes.

How do you remove padding from container-fluid Bootstrap?

As an improvement of this answer, you can easily remove padding and avoid the horizontal scrollbar simply adding the no-gutters class to the row element. This removes the negative margins as stated by the official documentation getbootstrap.com/docs/4.0/layout/grid/#no-gutters. So, no further css rules are needed.

How do I remove the default padding from container-fluid?

padding-right: 15px; padding-left: 15px; px-0 can remove the horizontal padding from container-fluid and no-gutters can remove the padding from col .

Do Bootstrap containers have padding?

Containers are a fundamental building block of Bootstrap that contain, pad, and align your content within a given device or viewport.


1 Answers

If i understand your question correctly, I believe you want this:

.container-fluid {     padding: 0px; } 

Also if you are using responsive bootstrap you will also want this:

@media (max-width: 797px) {     body {          padding-left: 0px;         padding-right: 0px;     } } 

Edit: here is a js fiddle.

like image 101
hajpoj Avatar answered Sep 28 '22 07:09

hajpoj