Bootstrap Grid Basic


Bootstrap system, the way to create responsive website layouts. Bootstrap has bunch of classes that support grid layouts in the form of row and columns to organize page contents. Bootstrap grid system enables to create layout for different types of devices like mobile, tablets, laptops and desktops etc. Bootstrap's grid system supports up to 12 columns across the page.

The .col-xs-* class is used to create grid columns for extra small devices like mobile. The .col-sm-* class is used for small screen devices like tablets. The .col-md-* class is used for medium size devices like desktops. The .col-lg-* class is used for large devices like desktops.

You can apply multiple classes to create dynamic grid system which supports multiple devices for example - if you apply .col-xs-* and .col-md-* classes, it will support two different devices, medium devices(md) and small devices(xs).

The below table demonstrates some of the key features of the new grid system

Features Extra small devices
Phones
Small devices
Tablets
Medium devices
Desktops
Large devices
Desktops
Max container width < 768px >= 768px >= 992px >= 1200px
Grid behavior Horizontal at all times Collapsed to start, horizontal above breakpoints
Class Name .col-xs-* .col-sm-* .col-md-* .col-lg-*
Max column width Auto ~62px ~81px ~97px
Gutter width 15px on each side of a column (i.e. 30px)

Bootstrap Grid Basic Structure

The below code demonstrates the basic structure of a Bootstrap grid:

<div class="row">
  <div class="col-*-*"></div>
  <div class="col-*-*"></div>
  <div class="col-*-*"></div>
</div>

In the above code, create a row using <div class="row">. Next, add the required number of columns using <div class="col-*-*"></div>. Remember that, number of columns in each row could be up to 12.

Four Equal Columns

<div class="row">
	<div class="col-sm-3">Column 3 Span</div><div class="col-sm-3">Column 3 Span</div>
	<div class="col-sm-3">Column 3 Span</div><div class="col-sm-3">Column 3 Span</div>
</div>
Try Now

The above code example will produce below output:

Column 4 Column 4 Column 4 Column 4

Three UnEqual Columns

<div class="row">
	<div class="col-sm-4">Column 4 Span</div><div class="col-sm-3">Column 3 Span</div><div class="col-sm-5">Column 5 Span</div>
</div>
Try Now

The above code example will produce below output:

Column 4 Column 3 Column 5

Single Column

<div class="row">
	<div class="col-sm-12">Column 12 Span</div>
</div>
Try Now

The above code example will produce below output:

Column 12


See Also

AngularJS Built-in Filters
AngularJS Built-in Directives
AngularJS Expression
AngularJS Built-in Events
AngularJS Scope Methods
AngularJS Built-in Services
AngularJS Controller Inheritance
AngularJS Custom Directives



 
 
SHARE THIS IF YOU LIKE!
submit to reddit

SUBSCRIBE FOR LATEST UPDATES
HAVE WE CONNECTED ON FACEBOOK?
TOP TUTORIALSTOP CODE EXAMPLESTOP LIVE DEMOLINKSSTAY CONNECTED
HTML Tutorial
HTML5 Tutorial
Bootstrap3 Tutorial
Javascript Tutorial
TypeScript Tutorial
AngularJS Tutorial
CSharp Tutorial
PHP Tutorial
Developer Tools
Javascript
AngularJS
Google MAP API V3
ASP.NET
Javascript
AngularJS
Google MAP API V3
Contact Us
Advertise with Us
Privacy Policy
Disclaimer
Stay connected. We actually like you. If you want to get up to the minute updates, then connect with us on your fav below.
 
Twitter   Linkedin   Facebook   Google+    RSS   Pinterest
 
Protected by Copyscape Original Content Checker
 
 
Copyright ©2017 www.techstrikers.com Unauthorized reproduction/replication of any part of this site is prohibited.