Search Topic Here

Sunday, 9 August 2015

Bootstrap Grid system


Bootstrap's grid system is responsive, and the columns will re-arrange automatically depending on the screen size.


Grid Classes

The Bootstrap grid system has four classes:

xs (for phones)
sm (for tablets)
md (for desktops)
lg (for larger desktops)

The classes above can be combined to create more dynamic and flexible layouts.


example:


<!doctype html>
<html lang="en">
 <head>

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

<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

<!-- Latest compiled JavaScript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

 </head>
 <body>
<div class="container-fluid">
  <h1>Hello World!</h1>
  <p>Resize the browser window to see the effect.</p>
  <div class="row">
    <div class="col-sm-2" style="background-color:lavender;">.col-sm-2<br>column2</div>
    <div class="col-sm-4" style="background-color:lavenderblush;">.col-sm-4</div>
    <div class="col-sm-4" style="background-color:green;">.col-sm-4</div>
  </div>
</div>

 </body>
</html>

output



Hello World!

Resize the browser window to see the effect.

.col-sm-2
column2
.col-sm-4
.col-sm-4

No comments:

Post a Comment