Articles → BOOTSTRAP → Bootstrap Grid
Bootstrap Grid
Purpose
Bootstrap Grid Classes
- xs id for phones - screens less than 768px wide
- sm is for tablets - screens equal to or greater than 768px wide
- md is for small laptops - screens equal to or greater than 992px wide
- lg class is used for laptops and desktops having screens equal to or greater than 1200px wide
Example
<!DOCTYPE html>
<html lang="en"
xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<link rel="stylesheet" href="bootstrap.css" />
</head>
<body>
<div class="container">
<div class="row">
<div class="col-6">Name</div>
<div class="col-6">City</div>
</div>
<div class="row">
<div class="col-6">Karan</div>
<div class="col-6">Delhi</div>
</div>
<div class="row">
<div class="col-6">Sumit</div>
<div class="col-6">Mumbai</div>
</div>
</div>
</body>
</html>
- A new row is created using the class "row".
- Each row is divided into 2 columns (6 parts each)
Click to Enlarge
Using Wild Card
<!DOCTYPE html>
<html lang="en"
xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<link rel="stylesheet" href="bootstrap.css" />
</head>
<body>
<div class="container">
<div class="row">
<div class="col-lg-6">Name</div>
<div class="col-lg-6">City</div>
</div>
<div class="row">
<div class="col-lg-* border">Karan</div>
<div class="col-lg-12">Delhi</div>
</div>
<div class="row">
<div class="col-lg-6">Sumit</div>
<div class="col-lg-6">Mumbai</div>
</div>
</div>
</body>
</html>
Click to Enlarge