Bootstrap Slides
Bootstrap Slides
Bootstrap
Summary of Today’s Lecture
• Bootstrap Introduction
• Bootstrap Grid System
• Bootstrap Grid Classes
• Bootstrap Grid Example (Photo Gallery)
• Bootstrap Column Layouts (Examples)
• Bootstrap Components (Examples)
– Navbar
– Jumbotron
– Breadcrumb
– Tables
– Buttons
– Forms
• Responsive Web Design Example (Restaurant Web Portal )
• What is Responsive Web Design?
Every row in the grid is made up of 12 units and you can define the
desired size of your columns using those units.
In our example we have defined one column each 4 units wide.
Grid Classes
• The Bootstrap 4 grid system has five classes:
– .col- (extra small devices - screen width less than 576px)
– .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)
– .col-xl- (xlarge devices - screen width equal to or greater than 1200px)
• The classes above can be combined to create more dynamic and
flexible layouts.
Responsive breakpoints
• Bootstrap is developed to be mobile first, we use a handful of
media queries to create sensible breakpoints for our layouts and
interfaces.
• These breakpoints are mostly based on minimum viewport widths
and allow us to scale up elements as the viewport changes.
Basic Structure of Bootstrap Grid
• <div class=“container”>
– <div class="row">
• <div class="col-*-*"></div>
• </div>
• <div class="row">
• <div class="col-*-*"></div>
• <div class="col-*-*"></div>
• <div class="col-*-*"></div>
• </div>
• <div class="row">
...
• </div>
• </div>
Extra Small Grid Example
• <div class="container">
<div class="row">
<div class="col-3 bg-success">
<p>Lorem ipsum...</p>
</div>
<div class="col-9 bg-warning">
<p>Sed ut perspiciatis...</p>
</div>
</div>
</div>
Small Grid Example
• <div class="container">
<div class="row">
<div class="col-sm-3 bg-success">
<p>Lorem ipsum...</p>
</div>
<div class="col-sm-9 bg-warning">
<p>Sed ut perspiciatis...</p>
</div>
</div>
</div>
Medium Grid Example
• <div class="container">
<div class="row">
<div class="col-sm-3 col-md-6">
<p>Lorem ipsum...</p>
</div>
<div class="col-sm-9 col-md-6">
<p>Sed ut perspiciatis...</p>
</div>
</div>
</div>
Large Grid Example
• <div class="container">
<div class="row">
<div class="col-sm-3 col-md-6 col-lg-4">
<p>Lorem ipsum...</p>
</div>
<div class="col-sm-9 col-md-6 col-lg-8">
<p>Sed ut perspiciatis...</p>
</div>
</div>
</div>
Extra Large Grid Example
• <div class="container">
<div class="row">
<div class="col-sm-3 col-md-6 col-lg-4 col-xl-2">
<p>Lorem ipsum...</p>
</div>
<div class="col-sm-9 col-md-6 col-lg-8 col-xl-10">
<p>Sed ut perspiciatis...</p>
</div>
</div>
</div>
• <div class="col-12 col-sm-6 col-md-4 col-lg-3 col-
xl-2">
• <a href="photo1.html"><img class="photo_list"
src="./images/img_1.jpg" alt="graffiti cover
image"/></a></div>
• <div class="col-12 col-sm-6 col-md-4 col-lg-3
col-xl-2">
• <a href="photo1.html"><img class="photo_list"
src="./images/img_1.jpg" alt="graffiti cover
image"/></a></div>
• <div class="col-12 col-sm-6 col-md-4 col-lg-3
col-xl-2">
• <a href="photo1.html"><img class="photo_list"
src="./images/img_1.jpg" alt="graffiti cover
image"/></a></div>
• <div class="col-12 col-sm-6 col-md-4 col-lg-3
col-xl-2">
• <a href="photo1.html"><img class="photo_list"
src="./images/img_1.jpg" alt="graffiti cover
image"/></a></div>
• <div class="col-12 col-sm-6 col-md-4 col-lg-3
col-xl-2">
• <a href="photo1.html"><img class="photo_list"
src="./images/img_1.jpg" alt="graffiti cover
image"/></a></div>
Example (Auto Column Layout)
• <!-- Two columns: 50% width-->
<div class="row">
<div class="col">1 of 2</div>
<div class="col">2 of 2</div>
</div>
• <div class="container">
• <p>This is some text.</p>
• <p>This is another text.</p>
• </div>
Bootstrap Buttons
• <div class="container">
– <button type="button" class= "btn btn-primary">hello click
me</button>
– <button type="button" class= "btn btn-seondary">hello click
me</button>
– <button type="button" class= "btn btn-success">hello click
me</button>
– <button type="button" class= "btn btn-danger">hello click
me</button>
– <button type="button" class= "btn btn-info">hello click
me</button>
– <button type="button" class= "btn btn-light disabled">hello click
me</button>
– <button type="button" class= "btn btn-outline-danger btn-
sm">hello click me</button>
• </div>
Buttons groups
• <div class="container">
• <h2>Button Group</h2>
• <p>The .btn-group class creates a button group:</p>
• <div class="btn-group">
• <button type="button" class="btn btn-primary">Apple</button>
• <button type="button" class="btn btn-primary">Samsung</button>
• <button type="button" class="btn btn-primary">Sony</button>
• </div>
• </div>
Bootstrap Navbar
• <nav class="navbar navbar-expand-sm bg-light">
• <ul class="navbar-nav">
• <li class="nav-item">
• <a class="nav-link" href="#">Link 1</a>
• </li>
• <li class="nav-item">
• <a class="nav-link" href="#">Link 2</a>
• </li>
• <li class="nav-item">
• <a class="nav-link" href="#">Link 3</a>
• </li>
• </ul>
• </nav>
Navbar Options
• <nav class="navbar navbar-expand-sm bg-light justify-
content-center">
...
</nav>
• <nav>
• <ol class="breadcrumb">
• <li class="breadcrumb-item"><a href="#">Home</a></li>
• <li class="breadcrumb-item active">Library</li>
• </ol>
• </nav>
• <nav>
• <ol class="breadcrumb">
• <li class="breadcrumb-item"><a href="#">Home</a></li>
• <li class="breadcrumb-item"><a href="#">Library</a></li>
• <li class="breadcrumb-item active">Data</li>
• </ol>
• </nav>
Bootstrap Tables
•
• <table class="table">
• <thead><tr>
• <th>Firstname</th>
• <th>Lastname</th>
• <th>Email</th></tr>
• </thead>
• <tbody>
• <tr>
• <td>John</td>
• <td>Doe</td>
• <td>[email protected]</td>
• </tr>
• <tr>
• <td>Mary</td>
• <td>Moe</td>
• <td>[email protected]</td>
• </tr>
• <tr>
• <td>July</td>
• <td>Dooley</td>
• <td>[email protected]</td>
• </tr>
• </tbody>
• </table>
Bootstrap Table (Striped)
• <table class="table table-striped">
• <thead>
• <tr>
• <th>Firstname</th>
• <th>Lastname</th>
• <th>Email</th>
• </tr>
• </thead>
• <tbody>
• <tr>
• <td>John</td>
• <td>Doe</td>
• <td>[email protected]</td>
• </tr>
• <tr>
• <td>Mary</td>
• <td>Moe</td>
• <td>[email protected]</td>
• </tr>
• <tr>
• <td>July</td>
• <td>Dooley</td>
• <td>[email protected]</td>
• </tr>
• </tbody>
• </table>
Bootstrap Forms (Stacked)
• <div class="container">
• <form>
– <div class= "form-group">
• <label for="user"> studentname: </label>
• <input type="text" name="" id="user" class="form-control">
– </div>
– <div class= "form-group">
• <label for="password"> Password: </label>
• <input type="text" name="" id="password" class="form-control">
– </div>
– <div class= "form-group">
• <label for="email"> Email: </label>
• <input type="text" name="" id="" class="form-control">
– </div>
– <input type="submit" name="" class= "btn btn-success">
• </form>
Bootstrap Forms (Inline)
• <div class="container">
• <form class=“form-inline”>
– <div class= "form-group">
• <label for="user"> studentname: </label>
• <input type="text" name="" id="user" class="form-control">
– </div>
– <div class= "form-group">
• <label for="password"> Password: </label>
• <input type="text" name="" id="password" class="form-control">
– </div>
– <div class= "form-group">
• <label for="email"> Email: </label>
• <input type="text" name="" id="" class="form-control">
– </div>
– <input type="submit" name="" class= "btn btn-success">
• </form>
• </div>
Restaurant Portal (Extra-Small Screen)
Home.html
Restaurant Portal (Small Screen)
Home.html
Restaurant Portal (Small Screen)
Aboutus.html
Restaurant Portal (Small Screen)
Contactus.html
Restaurant Portal (Small Screen)
Contactus.html
Summary of Today’s Lecture
• Bootstrap Introduction
• Bootstrap Grid System
• Bootstrap Grid Classes
• Bootstrap Grid Example (Photo Gallery)
• Bootstrap Column Layouts (Examples)
• Bootstrap Components (Examples)
– Navbar
– Jumbotron
– Breadcrumb
– Tables
– Buttons
– Forms
• Responsive Web Design Example (Cuisine Web Portal )
References
• https://getbootstrap.com/docs/4.5/getting-started/introduction/
• https://getbootstrap.com/docs/4.4/layout/grid/
• https://www.w3schools.com/bootstrap4/bootstrap_grid_system.as
p
• https://en.wikipedia.org/wiki/Bootstrap_(front-end_framework)
• https://v5.getbootstrap.com/docs/5.0/getting-started/introduction
/