Presented by Swapnil Meshram within mentorship within @devsyncin
๐ Introduction
๐ Bootstrap is a powerful, open-source CSS framework developed by Twitter to create responsive, mobile-first websites quickly. When paired with HTML, it simplifies the design process by offering pre-designed components and utility classes.
๐ What is Bootstrap?
๐ง Bootstrap is a front-end framework that includes:
๐ฆ Predefined CSS classes
๐ Responsive grid system
๐จ UI components (buttons, cards, modals, etc.)
๐ฒ Mobile-first design philosophy
๐ก Bootstrap works best with basic knowledge of HTML and CSS.
๐ธ Method 1: CDN (Recommended for Beginners)
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
๐ธ Method 2: Download and Host Locally
๐งฐ Download Bootstrap files from:
Then link them in the project directory.
๐ Basic HTML Structure with Bootstrap
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bootstrap Page</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<h1 class="text-center text-primary">Welcome to Bootstrap</h1>
</div>
</body>
</html>
๐ฆ Bootstrap Grid System
๐ 12-column grid for responsive layout
๐ก Use classes like container, row, and col.
๐ป Example:
<div class="container">
<div class="row">
<div class="col-md-4">Column 1</div>
<div class="col-md-4">Column 2</div>
<div class="col-md-4">Column 3</div>
</div>
</div>
๐งช Try resizing the window to see the responsive behaviour.
๐งฉ Common Bootstrap Components
๐ Buttons
<button class="btn btn-primary">Click Me</button>
<button class="btn btn-danger">Delete</button>
๐ฆ Cards
<div class="card" style="width: 18rem;">
<img src="..." class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Title</h5>
<p class="card-text">Some text here.</p>
<a href="#" class="btn btn-primary">Go</a>
</div>
</div>
๐ Forms
<form>
<input type="text" class="form-control" placeholder="Enter Name">
<button class="btn btn-success mt-2">Submit</button>
</form>
๐งฐ Advanced Components
๐ฆ Navbar
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">Site</a>
</nav>
๐ฒ Modal
<!-- Trigger -->
<button data-bs-toggle="modal" data-bs-target="#myModal">Launch Modal</button>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Modal Title</h5>
</div>
<div class="modal-body">This is a modal!</div>
<div class="modal-footer">
<button class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
๐งญ Bootstrap Icons
๐ป Add this in
to use icons:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css">
Then use:
<i class="bi bi-house-door"></i>
๐งช Advanced Layout Techniques
๐ธ Responsive Embeds
<div class="ratio ratio-16x9">
<iframe src="..." title="YouTube video"></iframe>
</div>
๐ธ Sticky Header
<nav class="navbar sticky-top navbar-light bg-light">Sticky!</nav>
โ๏ธ Utilities & Helper Classes
๐ง Bootstrap provides utility classes for:
โ Spacing โ m-3, p-2
โ Colors โ text-danger, bg-warning
โ Text alignment โ text-center, text-end
โ Display โ d-none, d-block
๐งช Try combining multiple classes to customise layout easily.
๐ข Responsive Design with Breakpoints
๐ฏ Bootstrap breakpoints:
sm โ small devices
md โ medium devices
lg โ large
xl โ extra large
๐ Bootstrap Layout Classes
container vs container-fluid
Flex layout โ d-flex, justify-content-center
Grid nesting โ use .row inside columns
Top comments (0)