bootstrap 3 columns code example

Example 1: bootstrap 3 offset

col-sm-offset-2

Example 2: bootstrap grid 2 rows

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>


<div class="row">
    <div class="col-md-4">
        <div class="well">1
            <br/>
            <br/>
            <br/>
            <br/>
            <br/>
        </div>
    </div>
    <div class="col-md-8">
        <div class="row">
            <div class="col-md-6">
                <div class="well">2</div>
            </div>
            <div class="col-md-6">
                <div class="well">3</div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-6">
                <div class="well">4</div>
            </div>
            <div class="col-md-6">
                <div class="well">5</div>
            </div>
        </div>
    </div>
</div>
<div class="row">
    <div class="col-md-4">
        <div class="well">6</div>
    </div>
    <div class="col-md-4">
        <div class="well">7</div>
    </div>
    <div class="col-md-4">
        <div class="well">8</div>
    </div>
</div>

Example 3: row class in bootstrap

/*
In Bootstrap, the "row" class is used mainly to hold columns in it.
Bootstrap divides each row into a grid of 12 virtual columns. 
In the following example, the col-md-6 div will have the width of 6/12 of the "row"s div, meaning 50%. 
The col-md-4 will hold 33.3%, and the col-md-2 will hold the remaining 16.66%.
*/

<div class="row">
    <div class="col-md-6"></div>
    <div class="col-md-4"></div>
    <div class="col-md-2"></div>
</div>

Example 4: col-md-6 bootstrap

<div class="col-lg-2 col-md-4 col-sm-3 "> Your Stuffs </div>

/*
col-lg  for large

col-md for med 

col-sm for small 

enjoy :) 
*/

Example 5: .col-12 bootstrap

.col-12{
	flex: 0 0 100%;
	max-width: 100%;
}

Example 6: 3 equal columns in bootstrap

<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <link href = "/bootstrap/css/bootstrap.min.css" rel = "stylesheet">
      <script src = "/scripts/jquery.min.js"></script>
      <script src = "/bootstrap/js/bootstrap.min.js"></script>
   </head>
   <body>
      <div class = "container-fluid">
         <h2>Bootstrap Grid</h2>
         <div class = "row">
            <div class = "col-sm-4" style = "background-color:green; color: white;">Column One</div>
            <div class = "col-sm-4" style = "background-color:orange; color: white;">Column Two</div>
            <div class = "col-sm-4" style = "background-color:gray; color: white;">Column Three</div>
         </div>
      </div>
   </body>
</html>

Tags:

Misc Example