Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between Bootstrap Spans & Columns

I working with bootstrap but trying to understand the difference between Spans and columns,

example

<div class="span4">...</div> or  <div class="col-md-4"></div> 

What's the difference between them or do they do same thing?

like image 844
user2965875 Avatar asked Feb 07 '14 14:02

user2965875


People also ask

What does span do in Bootstrap?

The Bootstrap "span" classes are used in the bootstrap grid system. The documentation shows columns labelled with numbers, each number represents the span class used for this container. Offset are shown right in the next section, they define how many empty columns should be to the left of the span.

What is XS SM MD lg in Bootstrap?

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)

What is Col MD 6 in Bootstrap?

col-sm- (small devices - screen width equal to or greater than 576px) . col-md- (medium devices - screen width equal to or greater than 768px) . col-lg- (large devices - screen width equal to or greater than 992px)

What is Bootstrap grid?

The Bootstrap Grid System is used for layout, specifically Responsive Layouts. Understanding how it works is vital to understanding Bootstrap. The Grid is made up of groupings of Rows & Columns inside 1 or more Containers. The Bootstrap Grid can be used alone, without the Bootstrap JavaScript and other CSS Components.


1 Answers

<div class="span4">...</div> 

is old Bootstrap syntax up until version 2.3.2 ,

<div class="col-md-4"></div> 

is Bootstrap version 3 syntax.

The main difference is that the new bootstrap is build on "mobile first" approach, while the old one used the typical 960gs approach to construct the grid and than had the responsivness handled separately.

You now have 4 different values that will scale the element differently based on screen size and wanted behaviour:

.col-md-*  

is the equivalent of span*, while:

.col-xs-*  .col-sm-*  .col-lg-*  

are used to solve the vertical stacking of elements on smaller devices (enabling you to achieve three column layouts on small screen devices by default, without having to overwrite bootstrap default classes with your own).

like image 115
easwee Avatar answered Oct 07 '22 16:10

easwee