Design responsive, mobile-first websites quickly using
Bootstrap’s pre-built components and grid system.
Defines a responsive fixed-width or fluid-width container.
<div class="container">Content here</div>
12-column responsive layout using rows and columns.
<div class="row">
<div class="col-6">Left</div>
<div class="col-6">Right</div>
</div>
Text formatting using classes like .display-1
,
.lead
, etc.
Interactive button elements with color and size classes.
<button class="btn btn-primary">Click Me</button>
Utility classes for text and background colors.
<p class="text-success bg-light">Success Text</p>
Displays alert messages with contextual classes.
<div class="alert alert-warning">Warning!</div>
Used to display content in a boxed format.
Navigation bar for linking to site pages.
Bootstrap-styled forms with validation, inputs, and more.
Styled input
, select
, and
textarea
elements.
Pop-up dialog boxes for alerts, confirmations, or forms.
Toggle visibility of content using collapse
class.
Interactive collapsible item panels grouped together.
Slideshow component for cycling through elements like images.
Displays small pop-up box when hovering over an element.
Like tooltips but more content can be added (e.g., title + body).
Toggles a dropdown menu from a button or link.
Show loading state using animation icons.
Non-blocking alert messages for quick feedback.
Navigate through pages using .pagination
class.
Indicates the current page’s location in a navigational hierarchy.
Small count or label next to elements like buttons or text.
Flexible components for displaying series of content.
Replaced with utility classes and custom components.
Utility classes for flexbox (e.g., d-flex
,
justify-content-center
).
Spacing utilities (e.g., m-3
, p-2
).
Control display of elements (e.g., d-none
,
d-block
).
Helps in absolute, fixed, and relative positioning.
Width and height utilities like w-25
, h-100
.
Controls stacking order using z-0
to z-3
.
Bootstrap includes six default breakpoints (xs, sm, md, lg, xl, xxl) for responsive design.
<div class="d-none d-md-block">Visible on md and
larger</div>
Bootstrap provides classes to create responsive, styled tables.
<table class="table table-striped">
<tr><th>Name</th><th>Age</th></tr>
<tr><td>John</td><td>25</td></tr>
</table>
Use .img-fluid
, .rounded
,
.img-thumbnail
to style images.
<img src="image.jpg" class="img-fluid rounded"
alt="...">
Creates side drawers for navigation or extra content.
<button data-bs-toggle="offcanvas"
data-bs-target="#demo">Open Menu</button>
Maintain aspect ratio for responsive iframes and videos.
<div class="ratio ratio-16x9">
<iframe src="..."
allowfullscreen></iframe>
</div>
Automatically updates active links based on scroll position.
<body data-bs-spy="scroll"
data-bs-target="#navbar">...</body>
Sticks element to the top on scroll using
.sticky-top
class.
<div class="sticky-top bg-white">Sticky
Header</div>
Vertically align content inside flex or table containers.
<div class="d-flex align-items-center">Vertically
Centered</div>
Control spacing between columns using g-*
classes.
<div class="row g-3"><div
class="col">One</div><div
class="col">Two</div></div>
Change column order in grid using .order-*
classes.
<div class="row">
<div class="col order-2">Second</div>
<div class="col order-1">First</div>
</div>
Use float-start
, float-end
, or
float-none
to float elements.
<div class="float-end">Floated Right</div>
Add .clearfix
to force parent to clear floated children.
<div class="clearfix"></div>
Use .visible
and .invisible
for visibility
control (element still takes space).
<div class="invisible">Hidden but still in
DOM</div>
Quickly set position-relative
, absolute
, or
fixed
.
<div class="position-fixed bottom-0 end-0">Fixed to Bottom
Right</div>
Control border appearance using .border
,
.border-0
, .border-primary
, etc.
<div class="border border-danger">Red
Border</div>
Add shadows with .shadow
, .shadow-sm
,
.shadow-lg
.
<div class="shadow p-3 mb-5 bg-body rounded">Box with
Shadow</div>
Use .rounded
, .rounded-circle
,
.rounded-pill
for border radius.
<img src="..." class="rounded-circle" alt="...">
Align text using .text-start
, .text-center
,
.text-end
.
<p class="text-center">Centered Text</p>
Use .align-items-center
and
.justify-content-center
with flexbox to center content.
<div class="d-flex justify-content-center align-items-center"
style="height: 100px;">Centered</div>
Maintain aspect ratio for embedded videos using
.ratio
classes.
<div class="ratio ratio-4x3">
<iframe src="..."
allowfullscreen></iframe>
</div>
Use .text-truncate
to cut off text and show ellipsis when
overflow occurs in a single line.
<div class="text-truncate" style="width: 200px;">This is a
very long text that will be truncated.</div>
Use .overflow-auto
, .overflow-hidden
, etc.,
to control content overflow.
<div class="overflow-auto" style="height: 100px;">Long
scrollable content here</div>
Provides a dismiss icon used in modals, alerts, etc. Use
.btn-close
.
<button type="button" class="btn-close"
aria-label="Close"></button>
Makes an entire element clickable using .stretched-link
.
<a href="#" class="stretched-link">Click anywhere</a>
Groups multiple buttons together with shared borders.
<div class="btn-group">
<button class="btn
btn-primary">Left</button>
<button class="btn
btn-primary">Middle</button>
<button class="btn
btn-primary">Right</button>
</div>
Convert buttons to toggle switches using
data-bs-toggle="button"
.
<button class="btn btn-primary"
data-bs-toggle="button">Toggle Me</button>
Add .disabled
or .active
to set the state of
buttons.
<button class="btn btn-secondary
disabled">Disabled</button>
Use Bootstrap's grid layout inside forms to align labels and inputs.
<div class="row">
<div class="col"><input type="text"
class="form-control" placeholder="First name"></div>
<div class="col"><input type="text"
class="form-control" placeholder="Last name"></div>
</div>
Use validation classes like .is-valid
,
.is-invalid
to show feedback.
<input type="text" class="form-control is-invalid">
Styled file input using form-control
class for modern
file upload fields.
<input class="form-control" type="file" id="formFile">