thenish
0
Q:

bootstrap container 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).
While containers can be nested, most layouts do not require a nested container.

Syntax:
<div class="container">
  <!-- Content here -->
</div>
4
The Bootstrap grid system has four classes:
xs (for phones - screens less than 768px wide)
sm (for tablets - screens equal to or greater than 768px wide)
md (for small laptops - screens equal to or greater than 992px wide)
lg (for laptops and desktops - screens equal to or greater than 1200px wide)
6
Our default .container class is a responsive, fixed-width container, meaning its max-width changes at each breakpoint.

<div class="container">
  <!-- Content here -->
</div>
2

<!----------------------- BOOTSTRAP GRID SYSTEM ------------------------>

This code will create 4 boxes placed side by side, which will be 
dynamically positioned, according to the size of the screen. We define 
the following behavior: 


<!-- Desktop Display: we have 4 columns per row (each occupies 3 units out of 12)  -->

class = "col-lg-3"   <!-- display large with 12/3 = 4 columns -->


<!-- Tablet Display: we have 3 columns per row (each occupies 4 units out of 12)  -->

class = "col-md-4"   <!-- display medium with 12/4 = 3 columns -->


<!-- Mobile Display: we have 2 columns per row (each occupies the 6 units of 12)  -->

class = "col-sm-6"  <!-- display small with 12/6 = 2 columns -->


<!-- CODE -->

  <div class="row">
    <div class="col-lg-3 col-md-4 col-sm-6" style="background-color:red; border:1px solid black;">
      One of four columns
    </div>
    <div class="col-lg-3 col-md-4 col-sm-6" style="background-color:yellow; border:1px solid black;">
      One of four columns
    </div>
    <div class="col-lg-3 col-md-4 col-sm-6" style="background-color:green; border:1px solid black;">
      One of four columns
  	</div>
    <div class="col-lg-3 col-md-4 col-sm-6" style="border:1px solid black;">
      One of four columns
  	</div>
  </div>
6
--------------------------------------------------------------------------------------
Bootstrap Container Width			 					| Size        | Class Prefix
--------------------------------------------------------------------------------------
Extra small devices Phones (less than 768px)  			| None (auto) | .col-xs-
Small devices Tablets (greater than equals 768px) 		| 750px       | .col-sm-
Medium devices Desktops (greater than equals 992px)     | 970px       | .col-md-
Large devices Desktops (greater than equals 1200px)     | 1170px      | .col-lg-
2

New to Communities?

Join the community