Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap row not occupying 100% width

I have a bootstrap grid layout but the row is not occupying 100% width. I am using Bootstrap 4 alpha 6. Here is the HTML:

<div class="container-fluid">
  <h1 class="center-text"  id="heading">[Enter Heaading Here]</h1>
  <div class="container">
    <div height="100px" class="row border-show">
      <div class="col-4" id="one"></div>
      <div class="col-4" id="two"></div>
      <div class="col-4" id="three"></div>
    </div>
  </div>
</div>

Here is the CSS:

.center-text{
  text-align: center;
}
#heading{
  padding: 60px;
}
.border-show{
  border-style: solid;
  border-color: black;
}
like image 841
Devansh Avatar asked May 02 '17 15:05

Devansh


People also ask

Which Bootstrap layout is 100% width?

Containers. Containers are the most basic layout element in Bootstrap and are required when using our default grid system. Choose from a responsive, fixed-width container (meaning its max-width changes at each breakpoint) or fluid-width (meaning it's 100% wide all the time).

Which of the class takes full width in Bootstrap?

container-fluid class can be used to get full width container. container-fluid class provides a full-width container which spans the entire width of the viewport.

Why is my Div width 100%?

div is block element. Block elements are 100% width of parent element, if width is not specified. Show activity on this post. it's taking up all the available space based on it's parent container, exactly what it's supposed to do.


2 Answers

In case someone else comes across this and the answer doesn't solve their problem, my issue that was causing this was because I didn't realize I was adding a row and trying to set up columns in a Bootstrap navbar. navbar already has a grid-like system in it by default, so it seems you are pushing it over the edge if you try to add columns inside of it. They aren't necessary anyway.

So if this answer doesn't solve your problem, check to see if you are inside of another Bootstrap component that already handles spacing. You may be trying to double-delimit your content!

like image 171
LeftOnTheMoon Avatar answered Oct 03 '22 21:10

LeftOnTheMoon


Remove it from the container. The container is not 100% width, and shouldn't be nested in another container.

like image 20
Zim Avatar answered Oct 03 '22 20:10

Zim