Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap Element 100% Width

I want to create alternating 100% colored blocks. An "ideal" situation is illustrated as an attachment, as well as the current situation.

Desired setup:

http://i.imgur.com/aiEMJ.jpg

Currently:

http://i.imgur.com/3Sl27.jpg

My first idea was to create an div class, give it a background color, and give it 100% width.

.block {     width: 100%;     background: #fff; } 

However, you can see that this obviously doesn't work. It's confined to a container area. I tried to close the container and that didn't work either.

like image 681
user1589214 Avatar asked Aug 10 '12 04:08

user1589214


People also ask

What does W 100 do in Bootstrap?

w-100 class to split a row's columns into two rows, when you could just make two rows? Bookmark this question.

Which of the class take full width in Bootstrap?

container class provides a responsive fixed width container. The . container-fluid class provides a full width container, spanning the entire width of the viewport.


1 Answers

The container class is intentionally not 100% width. It is different fixed widths depending on the width of the viewport.

If you want to work with the full width of the screen, use .container-fluid:

Bootstrap 3:

<body>   <div class="container-fluid">     <div class="row">       <div class="col-lg-6"></div>       <div class="col-lg-6"></div>     </div>     <div class="row">       <div class="col-lg-8"></div>       <div class="col-lg-4"></div>     </div>     <div class="row">       <div class="col-lg-12"></div>     </div>   </div> </body> 

Bootstrap 2:

<body>   <div class="row">     <div class="span6"></div>     <div class="span6"></div>   </div>   <div class="row">     <div class="span8"></div>     <div class="span4"></div>   </div>   <div class="row">     <div class="span12"></div>   </div> </body> 
like image 69
Ross Allen Avatar answered Oct 20 '22 09:10

Ross Allen