Bootstrap Cheat Sheet - A Basic Guide to Bootstrap
Last Updated :
23 Jul, 2025
Bootstrap is a free, open-source, potent CSS framework and toolkit used to create modern and responsive websites and web applications. It is the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites. Nowadays, websites are perfect for all browsers and all sizes of screens.

What is Bootstrap Cheat Sheet?
A Bootstrap Cheat Sheet is a comprehensive, quick-reference guide that provides web developers with an easy way to access the various classes, components, and utilities available in the Bootstrap framework. It’s a valuable tool that can significantly enhance the efficiency and productivity of web development.
Table of Content
Bootstrap provides ready-to-use form styles, including input fields, checkboxes, radio buttons, and more. Easily create user-friendly forms with minimal effort.
Element | Description | Syntax
|
---|
Form control | Default class for styling elements.
| .form-control
|
Select | Shows a collapsible list of values that can be selected.
| .form-select
|
Checks and radio | Used for radio-buttons and checkboxes
| .form-check
|
Range | Defines the range
| .form-control-range
|
Layout | Two major layout options. Fluid and fixed layout
|
|
Validation | Used to apply validation.
| :valid|invalid
|
Datalist | Style the data list using form-control classes.
|
|
Input group | Added as a wrapper around each input type or form control.
| .input-group
|
Example Code:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Form</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">
</script>
</head>
<body>
<h1 class="text-success text-center">
GeeksforGeeks
</h1>
<h2 class="text-center">Stacked form</h2>
<div class="container">
<form action="#">
<div class="form-group">
<label for="fname">First Name:</label>
<input type="text" class="form-control" id="fname"
placeholder="Enter First Name" name="fname">
</div>
<div class="form-group">
<label for="lname">Last Name:</label>
<input type="text" class="form-control" id="lname"
placeholder="Enter Last Name" name="lname">
</div>
<div class="form-group">
<label for="email">Email Id:</label>
<input type="email" class="form-control" id="email"
placeholder="Enter Email Id" name="email">
</div>
<div class="form-group">
<label for="contact">Contact No:</label>
<input type="text" class="form-control" id="contact"
placeholder="Enter Contact Number" name="contact">
</div>
<div class="form-group form-check">
<label class="form-check-label">
<input class="form-check-input" type="checkbox" name="remember">
Remember me
</label>
</div>
<button type="submit" class="btn bg-success">
Submit
</button>
</form>
</div>
</body>
</html>
Input Groups
Input Groups in Bootstrap are used to combine form controls with text, buttons, or other elements using input groups. Useful for search bars, currency inputs, and more.
Class | Description | Syntax |
---|
Prepend | Adds group to the front of the input.
| .input-group-prepend
|
Append | Add group behind the input.
| .input-group-append
|
Text | Styles the text that is displayed inside the group.
| .input-group-text
|
Small | Makes input groups smaller.
| .input-group-sm
|
Large | Makes input groups larger.
| .input-group-lg
|
Group | Makes size of the input group default.
| .input-group
|
Example Code:
HTML
<!DOCTYPE html>
<html>
<head>
<!-- Include Bootstrap CSS -->
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<title>Input Groups in Bootstrap</title>
</head>
<body>
<div class="container">
<h5>Sizing</h5>
<div class="input-group input-group-sm mb-3">
<!-- Prepend the following content to the input box -->
<div class="input-group-prepend">
<span class="input-group-text" id="small">Small</span>
</div>
<input type="text" class="form-control">
</div>
<div class="input-group mb-3">
<!-- Prepend the following content to the input box -->
<div class="input-group-prepend">
<span class="input-group-text" id="medium">Default</span>
</div>
<input type="text" class="form-control">
</div>
<div class="input-group input-group-lg">
<!-- Prepend the following content to the input box -->
<div class="input-group-prepend">
<span class="input-group-text" id="large">Large</span>
</div>
<input type="text" class="form-control">
</div>
<br>
<h5>Prepend Group Example</h5>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text" id="username">@</span>
</div>
<input type="text" class="form-control" placeholder="Username">
</div>
<br>
<h5>Append Group Example</h5>
<div class="input-group">
<input type="text" class="form-control" placeholder="Email">
<!-- Prepend the following content to the input box -->
<div class="input-group-append">
<span class="input-group-text" id="email">@example.com</span>
</div>
</div>
</div>
</body>
</html>
Navbars
Design responsive navigation bars that adapt to different screen sizes. Customize menus, logos, and navigation links.
Navbars | Description | Syntax
|
---|
Basic | Creates default navbar
| .navbar
|
Inverted | Inverts the color of default navbar
| .navbar-inverse
|
Colored | Changes background color
| .bg-*
|
Right-aligned | Right aligns the navbar
| .navbar-right
|
Fixed | Fixes the navigation bar at the top of the webpage.
| .navbar-fixed-top
|
Dropdown | Makes a drop-down interface.
| .dropdown
|
Collapsible | Makes a collapsible navbar
| .navbar-collapse
|
Code:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Navbar Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js">
</script>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">WebsiteName</a>
</div>
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
Page 1<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Page 1.1</a></li>
<li><a href="#">Page 1.2</a></li>
<li><a href="#">Page 1.3</a></li>
</ul>
</li>
<li><a href="#">Page 2</a></li>
<li><a href="#">Page 3</a></li>
</ul>
</div>
</nav>
</body>
</html>
Alerts
Alerts provide contextual feedback messages for typical user actions with a handful of available and flexible alert messages. Alerts are available for any length of text, as well as an optional close button. There are eight types of alerts available in Bootstrap 5.
Each of the classes has different colors associated with them.
Class | Description | Syntax |
---|
Primary | Alert is blue in color..
| .alert-primary
|
Secondary | Shows alert in the secondary background color.
| .alert-secondary
|
Success | Shows the alert green color.
| .alert-success
|
Danger | Alert is red in color.
| .alert-danger
|
Warning | Shows the alert in the color yellow
| .alert-warning
|
Info | Shows the alert in the color light blue.
| .alert-info
|
Light | Alert is in light gray background color.
| .alert-light
|
Dark | Shows the alert in dark gray background color.
| .alert-dark
|
Dismissible | Shows alert with a close button.
| .alert-dismissible
|
Example Code:
HTML
<!DOCTYPE html>
<html>
<head>
<title>
Bootstrap 5 | Alerts
</title>
<!-- Load Bootstrap -->
<link rel="stylesheet" href=
"https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css">
</head>
<body>
<div style="text-align: center;
width:600px;">
<h1 style="color: green;">
GeeksforGeeks
</h1>
</div>
<div id="canvas" style="width: 600px;
height: 200px; margin: 20px;">
<div class="alert alert-primary" role="alert">
Primary Alert
<div class="alert alert-secondary" role="alert">
Secondary Alert
</div>
<div class="alert alert-success" role="alert">
Success Alert
</div>
<div class="alert alert-danger" role="alert">
Danger Alert
</div>
<div class="alert alert-warning" role="alert">
Warning Alert
</div>
<div class="alert alert-info" role="alert">
Info Alert
</div>
<div class="alert alert-light" role="alert">
Light Alert
</div>
<div class="alert alert-dark" role="alert">
Dark Alert
</div>
</div>
</body>
</html>
Badges
Badges are numerical indicators to highlight the number of items associated with a link or new or unread item. The class. badge within the <span> element is used to create badges.
We can have some variations in badges using the following classes:
Class | Description | Syntax
|
---|
Contextual variations | Used to change the appearance of a badge.
| .badge .bg-*
|
Pill Badges | Used to make badges more rounded
| .rounded-pill
|
Example Code:
HTML
<!DOCTYPE html>
<html>
<head>
<!-- Load Bootstrap -->
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">
</script>
</head>
<body>
<div style="text-align: center;width: 600px;">
<h5 style="color: green;">
GeeksforGeeks
</h5>
</div>
<div id="canvas" style="width: 600px;
height: 200px;margin:20px;">
<h5>
Primary
<span class="badge bg-primary">
GeeksforGeeks
</span>
</h5>
<h5>
Secondary
<span class="badge bg-secondary">
GeeksforGeeks
</span>
</h5>
<h5>
Success
<span class="badge bg-success">
GeeksforGeeks
</span>
</h5>
<h5>
Danger
<span class="badge bg-danger">
GeeksforGeeks
</span>
</h5>
<h5>
Light
<span class="badge bg-light text-dark">
GeeksforGeeks
</span>
</h5>
<h5>
Dark
<span class="badge bg-dark">
GeeksforGeeks
</span>
</h5>
<h5>Pill Badge
<span class="badge badge-warning badge-pill">
2
</span>
</h5>
<h5>Badge inside an element
<button type="button" class="btn btn-primary">
Notifications
<span class="badge bg-secondary">
10
</span>
</button
></h5>
</div>
</body>
</html>
Breadcrumbs
Create breadcrumb trails to indicate the user’s location within a website’s hierarchy. Useful for navigation and context. It provides a backlink to each previous page the user navigates through.
Syntax:
<ol class="breadcrumb">
<li class="breadcrumb-item"> Content .. </li>
</ol>
Example Code:
HTML
<!DOCTYPE html>
<html>
<head>
<title>
Breadcrumbs Example
</title>
<link rel="stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css"
integrity=
"sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I"
crossorigin="anonymous">
</head>
<body>
<div style="text-align: center;width: 600px;">
<h1 style="color: green;">
GeeksforGeeks
</h1>
</div>
<div style="width: 600px;height: 200px;
margin:20px;">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item active">
GeeksforGeeks
</li>
</ol>
</nav>
</div>
</body>
</html>
Bootstrap offers versatile button styles, sizes, and states. Use them for calls to action, form submissions, or toggling functionality. Bootstrap also provides classes that can be used for changing the state and size of buttons, and also, provides classes for applying toggle,checkbox, and radio buttons-like effects.
Button type | Description | Syntax
|
---|
Solid | Used to create solid button styles.
| .btn-*
|
Outlined | Creates outlined buttons.
| .btn-outline-*
|
Changing Size | Changes the size of button.
| .btn-lg|sm|block
|
Toggle | Toggles the state of the button
| <button data-toggle="button">
|
Radio | Creates radio styled buttons
| <input type="checkbox">
|
Checkbox | Creates checkbox styled buttons
| <input type= "radio">
|
Example Code:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Bootstrap CSS -->
<link rel="stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css"
integrity=
"sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS"
rossorigin="anonymous">
<title>Button Example</title>
<!-- Custom CSS -->
<style>
h1 {
color: green;
text-align: center;
}
div.one {
margin-top: 40px;
text-align: center;
}
a,
button {
margin-top: 10px;
}
</style>
</head>
<body>
<div class="container">
<h1>GeeksForGeeks</h1>
<!-- Bootstrap Button Classes -->
<div class="one">
<button type="button" class="btn btn-primary">
Primary</button>
<button type="button" class="btn btn-secondary">
Secondary</button>
<button type="button" class="btn btn-success">
Success</button>
<button type="button" class="btn btn-danger">
Danger</button>
<button type="button" class="btn btn-warning">
Warning</button>
<button type="button" class="btn btn-info">
Info</button>
<button type="button" class="btn btn-light">
Light</button>
<button type="button" class="btn btn-dark">
Dark</button>
<button type="button" class="btn btn-link">
Link</button>
</div>
<div class="one">
<button type="button" class="btn btn-outline-primary">
outline</button>
<button type="button" class="btn btn-secondary btn-lg">
Large</button>
<button type="button" class="btn btn-success btn-sm">
Small</button>
<a href="#" class="btn btn-danger active" role="button" aria-pressed="true">
Active</a>
<a href="#" class="btn btn-warning disabled" role="button" aria-disabled="true" tabindex="-1">
Disabled</a>
<button type="button" class="btn btn-info" data-toggle="button"
aria-pressed="false" autocomplete="off">
Toggle
</button>
<div class="btn-group-toggle" data-toggle="buttons">
<label class="btn btn-light active">
<input type="checkbox" checked autocomplete="off">
Checked</label>
<label class="btn btn-dark">
<input type="radio" name="options" id="option1" autocomplete="off">
Radio</label>
</div>
</div>
</div>
</body>
</html>
Button groups
Bootstrap allows us to group a series of buttons together in a single line vertically or horizontally(without spaces) using the button group class. These classes are as follows:
Class | Description | Syntax
|
---|
Style | Add styles to buttons
| .btn-primary|default|success|info|link
|
Size | Changes the sizing of buttons.
| .btn-group-*
|
Nesting | Stacks the button in vertical manner
| .btn-group-vertical
|
Vertical | Creates a dropdown menu within the buttons
| .btn-group
|
Button toolbar | Combine button groups into button toolbars
| .btn-toolbar
|
Example Code:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js">
</script>
</head>
<body>
<p>Styling Button Groups</p>
<div class="btn-group">
<button type="button" class="btn btn-danger">Click</button>
<button type="button" class="btn btn-warning">Click</button>
<button type="button" class="btn btn-success">Click</button>
</div>
<br />
<p>Sizing Button Groups</p>
<div>
<div class="btn-group btn-group-lg">
<button type="button" class="btn btn-danger">Click</button>
<button type="button" class="btn btn-warning">Click</button>
<button type="button" class="btn btn-success">Click</button>
</div>
<div class="btn-group">
<button type="button" class="btn btn-danger">Click</button>
<button type="button" class="btn btn-warning">Click</button>
<button type="button" class="btn btn-success">Click</button>
</div>
<div class="btn-group btn-group-sm">
<button type="button" class="btn btn-danger">Click</button>
<button type="button" class="btn btn-warning">Click</button>
<button type="button" class="btn btn-success">Click</button>
</div>
<div class="btn-group btn-group-xs">
<button type="button" class="btn btn-danger">Click</button>
<button type="button" class="btn btn-warning">Click</button>
<button type="button" class="btn btn-success">Click</button>
</div>
</div>
<br>
<p>Vertical Button groups</p>
<div class="btn-group-vertical">
<button type="button" class="btn btn-danger">Click</button>
<button type="button" class="btn btn-warning">Click</button>
<button type="button" class="btn btn-success">Click</button>
</div>
<p>Nesting of button groups</p>
<div class="btn-group">
<button type="button" class="btn btn-danger">Click</button>
<button type="button" class="btn btn-warning">Click</button>
<div class="btn-group">
<button type="button" class="btn btn-success
dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
Dropdown</button>
<ul class="dropdown-menu" aria-labelledby="btnGroupDrop1">
<li><a class="dropdown-item" href="#">Item 1</a></li>
<li><a class="dropdown-item" href="#">Item 2</a></li>
</ul>
</div>
</div>
</body>
</html>
Cards
A card is a flexible and extensible content container. It includes options for headers and footers, a wide variety of content, contextual background colors, and powerful display options.
Type | Description | Syntax
|
---|
Basic | The building block of a card is the card-body and card.
| .card .card-body
|
Headers and footers | Provides header and footer to the card.
| .card-header|footer
|
Title and Links | Gives a title and link to the card.
| .card-title|link
|
Images | Used to add images to the card.
| .card-img
|
Overlays | Adds overlay to the card image
| .card-img-overlay
|
Card Group | Used to add groups to the card
| .card-deck
|
List group | Creates a list of content in card.
| .card
|
Example Code:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Card</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">
</script>
</head>
<body>
<div class="container">
<h4>Basic Card</h4>
<h2 style="color:green;">GeeksforGeeks</h2>
<div class="card">
<div class="card-body">
A computer science portal for geeks
</div>
</div>
<br />
<h4>Header and Footer card</h4>
<div class="card">
<div class="card-header">Header</div>
<div class="card-body">Content</div>
<div class="card-footer">Footer</div>
</div>
<br />
<h4>Title and links card</h4>
<div class="card">
<div class="card-body">
<h4 class="card-title">Card title</h4>
<p class="card-text">
Some example text. Some example text.
</p>
<a href="#" class="card-link">Card link</a>
<a href="#" class="card-link">Another link</a>
</div>
</div>
<br />
<h4>Card with images</h4>
<div class="card" style="width:200px">
<img class="card-img-top"
src=
"https://media.geeksforgeeks.org/wp-content/cdn-uploads/20190530183756/Good-Habits-for-developers-programmers.png"
alt="Card image" style="width:100%">
<div class="card-body">
<h4 class="card-title">Developer Guy</h4>
<p class="card-text">
Developer Guy love to develop
front-end and back-end
</p>
</div>
</div>
<br />
<h4>Card group</h4>
<div class="card-deck">
<div class="card-text-white bg-primary">
<div class="card-body">
<h4 class="card-title">PRIMARY</h4>
</div>
</div>
<div class="card-text-white bg-success">
<div class="card-body">
<h4 class="card-title">SUCCESS</h4>
</div>
</div>
<div class="card-text-white bg-danger">
<div class="card-body">
<h4 class="card-title">DANGER</h4>
</div>
</div>
</div>
<br />
<h4>List Groups</h4>
<div class="card">
<ul class="list-group list-group-flush">
<li class="list-group-item">Bootstrap</li>
<li class="list-group-item">HTML</li>
<li class="list-group-item">JavaScript</li>
</ul>
</div>
</div>
</body>
</html>
Carousel
Carousal is used in bootstrap to create slideshows of images on a website. It is used to cycle through a series of images and text. Significant parts of a carousal are:
Type | Description | Syntax
|
---|
Slide | The content and image of each slide is defined here
| .carousel .slide
|
Fade | Used to add a fading effect to the transition.
| .carousel-fade
|
Indicators | The indicators are the little dots at the bottom of each slide.
| .carousel-indicators
|
Captions | Adds text associated with image to the carousal.
| .carousel-captions
|
Controls | Alows us to go back and forth.
| .carousel-control-next|previous-icon
|
Example Code:
HTML
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Carousel</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js">
</script>
</head>
<body>
<center>
<h1 class="text-success">GeeksforGeeks</h1>
<h4>Bootstrap | Carousel</h4>
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src=
"https://media.geeksforgeeks.org/wp-content/cdn-uploads/20190603152813/ml_gaming.png">
</div>
<div class="item">
<img src=
"https://media.geeksforgeeks.org/wp-content/cdn-uploads/20190528184201/gateexam.png">
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
</center>
</body>
</html>
Grids
Bootstrap's grid system allows up to 12 columns across the page. The grid system helps align page elements based on sequenced columns and rows. We use this column-based structure to place text, images, and functions in a consistent way throughout the design.
Components
| Description | Syntax
|
---|
Container | It is a container of row elements
| .container
|
Row | Container for column elements
| .row
|
Column | Used to specify the number of available columns.
| .col
|
column reset | Used to resolve issues regarding viewport.
| .clearfix
|
column offset | Moves the columns to the right by x columns.
| .col-md|lg|cs-offset-value
|
Extra Small | Used for portrait mobile phones.
| .col-xs
|
Small | Used for Landscapes phones
| .col-sm
|
Medium | Used for Tablets/Phablets
| .col-md
|
large | Used for Small-sized Desktops/Laptops
| .col-lg
|
Extra large | Used for Larger-sized Desktops/Laptops
| .col-xl
|
Example Code:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">
</script>
</head>
<body>
<header>
<div class="container">
<h1 style="color: green">GeeksforGeeks</h1>
<strong>
A computer Science portal for Geeks
</strong>
</div>
</header>
<div class="container">
<div class="row">
<div class="bg bg-secondary w-100">
First Row
</div>
</div>
<div class="row">
<div class="bg bg-primary w-100">
Second row
</div>
</div>
</div>
<br />
<div class="container">
<div class="row">
<div class="col-xs-2 col-sm-6 col-md-3
col-lg-4 col-xl-6">
<div class="well bg bg-success">
First Column
</div>
</div>
<div class="col-xs-2 col-sm-6 col-md-3
col-lg-4 col-xl-6">
<div class="well bg bg-danger">
Second Column
</div>
</div>
<div class="col-xs-2 col-sm-6 col-md-3
col-lg-4 col-xl-6">
<div class="well bg bg-warning">
Third Column
</div>
</div>
<div class="col-xs-2 col-sm-6 col-md-3
col-lg-4 col-xl-6">
<div class="well bg bg-primary">
Fourth Column
</div>
</div>
</div>
</div>
<footer>
<hr />
<div class="container">
<p>
<a href="https://www.geeksforgeeks.org/">
Visit
</a>
our website
</p>
<p>
<a href="https://www.geeksforgeeks.org/">
Like
</a>
us on facebook
</p>
</div>
</footer>
</body>
</html>
Pagination is used to enable navigation between pages on a website. The pagination used in Bootstrap has a large block of connected links that are hard to miss and easily scalable.
Type | Description | Syntax
|
---|
Basic | Specifies pagination on a list group.
| .pagination
|
Disabled | Makes pagination appear unclickable.
| .disabled
|
Active | Highlights the currently active page
| .active
|
Sizing | Changes the sizing of the pagination group
| .pagination-sm|md|lg
|
Alignment | Sets the alignement of pagination group
| .justify-content-center|end
|
Example Code:
HTML
<!DOCTYPE html>
<html>
<head>
<title>Pagination</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">
</script>
</head>
<body>
<div class="container">
<h5>Basic Pagination</h5>
<ul class="pagination">
<!-- Declare the item in the group -->
<li class="page-item">
<!-- Declare the link of the item -->
<a class="page-link" href="#">Previous</a>
</li>
<!-- Rest of the pagination items -->
<li class="page-item">
<a class="page-link" href="#">1</a>
</li>
<li class="page-item">
<a class="page-link" href="#">2</a>
</li>
<li class="page-item">
<a class="page-link" href="#">3</a>
</li>
<li class="page-item">
<a class="page-link" href="#">Next</a>
</li>
</ul>
<br />
<h5>Disabled and active</h5>
<!-- Declare the pagination class -->
<ul class="pagination">
<!-- Specify the disabled class to style this item disabled -->
<li class="page-item disabled">
<!-- Specify tabindex to make the link non navigatable -->
<a class="page-link" href="#" tabindex="-1">
Previous
</a>
</li>
<li class="page-item">
<a class="page-link" href="#">
1
</a>
</li>
<li class="page-item">
<a class="page-link" href="#">2</a>
</li>
<li class="page-item active">
<a class="page-link" href="#">3</a>
</li>
<li class="page-item">
<a class="page-link" href="#">Next</a>
</li>
</ul>
<h5>Pagination Sizing</h5>
<b>Large Pagination</b>
<!-- Specify pagination-lg for large pagination group -->
<ul class="pagination pagination-lg">
<li class="page-item">
<a class="page-link" href="#">Previous</a>
</li>
<li class="page-item">
<a class="page-link" href="#">1</a>
</li>
<li class="page-item">
<a class="page-link" href="#">2</a>
</li>
<li class="page-item">
<a class="page-link" href="#">3</a>
</li>
<li class="page-item">
<a class="page-link" href="#">Next</a>
</li>
</ul>
<b>Small Pagination</b>
<!-- Specify pagination-sm for small pagination group -->
<ul class="pagination pagination-sm">
<li class="page-item">
<a class="page-link" href="#">Previous</a>
</li>
<li class="page-item">
<a class="page-link" href="#">1</a>
</li>
<li class="page-item">
<a class="page-link" href="#">2</a>
</li>
<li class="page-item">
<a class="page-link" href="#">3</a>
</li>
<li class="page-item">
<a class="page-link" href="#">Next</a>
</li>
</ul>
<b>Normal Pagination</b>
<!-- Normal size pagination -->
<ul class="pagination">
<li class="page-item">
<a class="page-link" href="#">Previous</a>
</li>
<li class="page-item">
<a class="page-link" href="#">1</a>
</li>
<li class="page-item">
<a class="page-link" href="#">2</a>
</li>
<li class="page-item">
<a class="page-link" href="#">3</a>
</li>
<li class="page-item">
<a class="page-link" href="#">Next</a>
</li>
</ul>
</div>
</body>
</html>
Dropdowns
Dropdowns are toggleable, contextual overlays for displaying lists of links and more. They’re made interactive with the included Bootstrap dropdown JavaScript plugin.
Class | Description | Syntax
|
---|
Divider | Creates a horizontal list to divide dropdown menu
| .dropdown
|
Header | Adds header section inside the dropdown list.
| .dropdown-header
|
Disable and active items | Used to diable and enable list of items.
| .active|disabled
|
Dropdown position | Sets the position of dropdown list.
| .dropright|dropleft
|
Dropdown Menu Right Aligned | Right aligns the dropdown menu.
| .dropdown-menu-right
|
Dropup | Expands the menu list upwards.
| .dropup
|
Dropdown text | Adds plain text in the dropdown menu list.
| .dropdown-item-text
|
Grouped Buttons with a Dropdown | Creates a group of buttons in the dropdown list.
| .btn-group
|
Split Button Dropdowns | Splits the dropdown buttons.
| .dropdown-toggle-split
|
Vertical Button Group Dropdown List | Creates a vertical button group.
| .btn-group-vertical
|
Example Code:
HTML
<!DOCTYPE html>
<html>
<head>
<!-- Load Bootstrap -->
<link rel="stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css"
integrity=
"sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I"
crossorigin="anonymous">
<script src=
"https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"
integrity=
"sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin="anonymous">
</script>
<script src=
"https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js"
integrity=
"sha384-oesi62hOLfzrys4LxRF63OJCXdXDipiYWBnvTl9Y9/TRlw5xlKIEHpNyvvDShgf/"
crossorigin="anonymous">
</script>
</head>
<body style="text-align: center;">
<div class="container mt-3" style="width: 700px;">
<h1 style="color: green;">
GeeksforGeeks
</h1>
<!-- Dropdown position-->
<div class="dropdown dropright">
<button type="button" class="btn btn-success dropdown-toggle"
data-toggle="dropdown">
Select Subjects
</button>
<div class="dropdown-menu">
<!-- header and divider -->
<strong class="dropdown-header ">
CS Subjects
</strong>
<a class="dropdown-item" href="#">
Data Structure
</a>
<a class="dropdown-item" href="#">
Algorithm
</a>
<a class="dropdown-item" href="#">
Operating System
</a>
<!--Active and Disabled -->
<a class="dropdown-item active" href="#">
Computer Networks
</a>
<div class="dropdown-divider "></div>
<strong class="dropdown-header">
Other Subjects
</strong>
<a class="dropdown-item" href="#">
Physics
</a>
<a class="dropdown-item disabled" href="#">
Mathematics
</a>
<a class="dropdown-item" href="#">
Chemistry
</a>
</div>
</div>
</div>
</body>
</html>
List group
List Groups are used to display a series of content. We can modify them to support any content as per our needs. The use of List-Groups is just to display a series or list of content in an organized way.
Class | Description | Syntax
|
---|
Disabled | Makes the list group disabled.
| .disabled
|
Active | Indicates the currently active item.
| .active
|
Hyperlinks and Buttons | Creates actionable list items with multiple states.
| .list-group-item-action
|
Flush | Flush class to remove some borders and rounded corners data
| .list-group-flush
|
Contextual | Style list items with suitable backgrounds and colors.
| .list-group-item-primary|secondary|info|light
|
Badges | Adds badges to list group items.
| .badge
|
Example Code:
HTML
<!DOCTYPE html>
<html>
<head>
<title>List Groups example</title>
<!-- Link Bootstrap Files -->
<link rel="stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css"
integrity=
"sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS"
crossorigin="anonymous">
<script src=
"https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity=
"sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous">
</script>
<script src=
"https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"
integrity=
"sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k"
crossorigin="anonymous">
</script>
</head>
<body>
<p>To do list</p>
<ul class="list-group">
<!-- active list group item -->
<li class="list-group-item active">study</li>
<!-- disabled list group item -->
<li class="list-group-item disabled">pay bills</li>
<li class="list-group-item">call mom</li>
<!-- Contextual list group item -->
<li class="list-group-item
list-group-item-info">
Info list group item
</li>
</ul>
<div>
<!-- hyperlink list group item -->
<a href="#" class="list-group-item list-group-item-action">drop an email</a>
</div>
<!-- badge list group item -->
<button type="button" class="list-group-item list-group-item-action">
UPDATES
<span class="badge badge-pill badge-danger">2</span>
</button>
</body>
</html>
Popovers
Popovers are used to display additional information about any element and are displayed with a click of a mouse pointer over that element.
Syntax:
data-toggle="popover"
title="Popover Header"
data-content="Some content inside the box"
The data-toggle attribute defines the Popover, the title attribute defines the Tile for the Popover and the data-content attribute is used to store the content to be displayed in the respective Popover.
Class | Description | Syntax
|
---|
Right-alignment | Displays the popover at right of the element.
| data-placement= "right"
|
Left-alignment | Displays the popover at left of the element.
| data-placement= "left"
|
Bottom-alignment | Displays the popover at bottom of the element.
| data-placement= "bottom"
|
Top-alignment | Displays the popover at top of the element.
| data-placement= "top"
|
Example Code:
HTML
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Example</title>
<!-- Link Bootstrap CSS -->
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js">
</script>
</head>
<body>
<div class="container">
<h3>Popover Example</h3>
<a href="#" data-toggle="popover" title="Popover Header"
data-content="Some content inside the popover">
GeeksforGeeks</a>
</div>
<script>
$(document).ready(function () {
$('[data-toggle="popover"]').popover();
});
</script>
</body>
</html>
Spinners
The spinners are used to specify the loading state of a component or webpage. Bootstrap facilitates the various classes for creating different styles of spinners by modifying their appearance, size, and placement.
Class | Description | Syntax
|
---|
Border | Used to rotate the spinner
| .spinner-border
|
Grow | Used for growing spinners.
| .spinner-grow
|
Margin | Adds margins to the spinners.
| .m-
value |
Placement | Places spinners at different positions
| .d-flex
|
Size | Changes the size of the spinners.
| .spinner-border-sm|md|lg|xl
|
Example Code:
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width">
<link href=
"https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet">
</head>
<body>
<h2 class="text-success text-center">
GeeksforGeeks
</h2>
<h5 class="text-info text-center">
Bootstrap Spinner Border
</h4>
<div class="d-flex justify-content-center">
<div class="spinner-border text-secondary"
role="status">
</div>
<span>Please Wait </span>
</div>
<br/>
<h5 class="text-info text-center">
Bootstrap Spinner Grow
</h5>
<div class="d-flex justify-content-center">
<span>
<h5>Processing</h5>
</span>
<div class="spinner-grow text-primary"
role="status">
</div>
</div>
<br/>
<h5 class="text-info text-center">
Spinner Placement using Bootstrap classes
</h5>
<br/>
<h5 class=" text-center">
Using the Text Placement Classes
</h5>
<div class="text-center">
<div class="spinner-border m-5 " role="status">
</div>
</div>
<h5 class="text-center">
Using the Flex Box Classes
</h5>
<div class="d-flex justify-content-center">
<div class="spinner-border" role="status">
</div>
</div>
</body>
</html>
Bootstrap Scrollspy targets the navigation bar contents automatically on scrolling the area. Scrollspy is used to update the navigation links when scrolling the page. The following attributes are added with the elements for the implementation of this feature.
Attribute | Description | Syntax
|
---|
Data-spy | This element is added to the scrollable area.
| data-spy="scroll"
|
Data-target | Connects the navigation bar with the scrollable area.
| data-target = ".id"
|
Data-offset | Specifies the number of pixels to offset from the top.
| data-offset = "value"
|
Example Code:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js">
</script>
<style>
body {
position: relative;
}
ul.nav-pills {
top: 20px;
position: fixed;
}
div.col-sm-9 div {
height: 250px;
font-size: 18px;
}
a {
color: green;
}
#section1 {
color: white;
background-color: green;
}
#section2 {
color: green;
background-color: white;
}
#section3 {
color: white;
background-color: green;
}
#section4 {
color: green;
background-color: white;
}
@media screen and (max-width: 810px) {
#section1,
#section2,
#section3,
#section4 {
margin-left: 150px;
}
}
</style>
</head>
<body data-spy="scroll" data-target="#myScrollspy" data-offset="20">
<div class="container">
<div class="row">
<nav class="col-sm-3" id="myScrollspy">
<ul class="nav nav-pills nav-stacked">
<li class="active"><a href="#section1">
Section 1</a>
</li>
<li><a href="#section2">Section 2</a></li>
<li><a href="#section3">Section 3</a></li>
<li><a href="#section4">Section 4</a></li>
</ul>
</nav>
<div class="col-sm-9">
<div id="section1">
<center>
<h1>Section 1</h1>
<h3>GeeksforGeeks</h3>
<h5>A computer science portal for geeks.</h5>
<h6> This portal has been created to
provide well written, well thought
and well explained solutions for
selected questions related to
programming, algorithms, other
computer science subjects.
</h6>
<p>Scroll this section and see the
navigation list while scrolling.
</p>
</center>
</div>
<div id="section2">
<center>
<h1>Section 2</h1>
<h3>GeeksforGeeks</h3>
<h5>A computer science portal for geeks.</h5>
<h6> This portal also provide GATE
previous year papers, short notes
for the aspirants.
</h6>
<p>Scroll this section and see the
navigation list while scrolling.
</p>
</center>
</div>
<div id="section3">
<center>
<h1>Section 3</h1>
<h3>GeeksforGeeks</h3>
<h5>A computer science portal for geeks.</h5>
<h6>This portal also provide interview
questions asked by private and
public sectors.
</h6>
<p>Scroll this section and see the
navigation list while scrolling.
</p>
</center>
</div>
<div id="section4">
<center>
<h1>Section 4</h1>
<h3>GeeksforGeeks</h3>
<h5>A computer science portal for geeks.</h5>
<h6>It also provide Internship aor
contributor program for students.
</h6>
<p>Scroll this section and see the
navigation list while scrolling.
</p>
</center>
</div>
</div>
</div>
</div>
</body>
</html>
A tooltip is quite useful for showing the description of different elements in the webpage. The tooltip can be invoked on any element in a webpage. Tooltips on bootstrap depend on the 3rd party library Tether for positioning. We can even customize this tooltip according to our requirements. Some of them are:
Class | Description | Syntax
|
---|
Placement | Used to place a tooltip.
| data-placement = "top|bottom|right|left"
|
Html | Adds HTML to a tooltip.
| data-html = "true"
|
Offset | Sets the offset of the tool-tip relative to target.
| data-offset = "number|string"
|
Animation | Adds or removes animation to tooltip.
| data-animation = "true|false"
|
Trigger | Adds the event which will trigger tooltip.
| data-trigger = "hover focus"
|
Example Code:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Tooltip</title>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<body style="text-align:center;">
<div class="container">
<h1 style="color:green;">
GeeksforGeeks
</h1>
<h2>Positioning Tooltip</h2>
<button data-toggle="tooltip" data-placement="top"
title="Top tooltip">Top
</button>
<button data-toggle="tooltip" data-placement="bottom"
title="Bottom tooltip">Bottom
</button>
<button data-toggle="tooltip" data-placement="left"
title="Left tooltip">Left
</button>
<button data-toggle="tooltip" data-placement="right"
title="Right tooltip">Right
</button>
</div>
<script>
$(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
});
</script>
</body>
</html>
Jumbotron
Bootstrap Jumbotron is a responsive component whose main goal is to draw the visitor’s attention or highlight a special piece of information. Inside a Jumbotron, you can make use of almost any other Bootstrap code to further increase its engagement value.
Fluid Jumbotron: To create a full-width Jumbotron we use the jumbotron-fluid class along with the Jumbotron class.
Example Code:
HTML
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet"
href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity=
"sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossorigin="anonymous">
</head>
<body>
<div class="jumbotron jumbotron-fluid">
<div class="container">
<h1 class="display-4">Jumbotron Example</h1>
<p class="lead">
This is a modified jumbotron that
occupies the entire horizontal
space of its parent.
</p>
</div>
</div>
</body>
</html>
Toasts
Toast is used to create something like an alert box which is shown for a short time like a couple of seconds when something happens. Like when the user clicks on a button or submits a form and many other actions.
- .toast: It helps to create a toast.
- .toast-header: It helps to create the toast header.
- .toast-body: It helps to create toast body
- .toast(“show”): It shows the toast
- .toast(“hide”): It hides the toast
- .toast(“dispose”): It disposes of the toast
Some of the events of toast are:
Event | Description |
---|
show.bs.toast | Occurs when the toast is about to be shown.
|
shown.bs.toast | Occurs when the toast is shown.
|
hide.bs.toast | Happens when the toast is about to be hidden.
|
hidden.bs.toast | Happens when the toast is fully hidden.
|
Example Code:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Toast Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">
</script>
</head>
<body style="text-align: center">
<h1 style="color:green">GeeksforGeeks</h1>
<div class="container mt-3">
<h3>.toast(options)</h3>
<p>
When we click the button below there
would be delay of the toast to 8000
milliseconds.
</p>
<button type="button" class="btn btn-primary"
id="myBtn">Show Toast</button>
<div class="toast mt-3">
<div class="toast-header">
Toast Header
</div>
<div class="toast-body">
Some text inside the toast body
</div>
</div>
</div>
<script>
$(document).ready(function () {
$('#myBtn').click(function () {
$('.toast').toast({
animation: false,
delay: 2000
});
$('.toast').toast('show');
});
});
</script>
</body>
</html>
Modal
Modals are used to add dialogs to your site for lightboxes, user notifications, or completely custom content. Modals are built with HTML, CSS, and JavaScript. They’re positioned over everything else in the document and remove scroll from the <body> so that modal content scrolls instead.
Syntax:
<div class="modal"> Contents... <div>
Class | Description | Syntax
|
---|
Popovers | Added inside the modal.
| .modal
|
Content | Triggers same modal with different data
| .modal-content
|
Extra Large Modal | Provides the largest modal size with a max-width of 1140px.
| .modal-xl
|
Large Modal | Provides a large modal size with a max-width of 800px.
| .modal-lg
|
Small Modal | Provides a small modal size with a max-width of 300px.
| .modal-sm
|
Example Code:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity=
"sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous"></script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity=
"sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity=
"sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"></script>
<link rel="stylesheet"
href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity=
"sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossorigin="anonymous">
<title>bootstrap | Modal</title>
<style>
h1,h6 {
margin: 2%;
}
.btn {
margin-left: 2%;
}
</style>
</head>
<body>
<center>
<h1 style="color:green;">GeeksforGeeks</h1>
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal"
data-target="#exampleModal">Launch Modal</button>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog"
aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="exampleModalLabel" style="color:green;">
GeeksforGeeks
</h6>
<!-- The title of the modal -->
<button type="button" class="close" data-dismiss="modal"aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<!-- The content inside the modal box -->
<p>The Content inside the modal </p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary"
data-dismiss="modal">Close</button>
<!-- The close button in the bottom of the modal -->
<button type="button" class="btn btn-primary">okay</button>
<!-- The save changes button in the bottom of the modal -->
</div>
</div>
</div>
</div>
</body>
</html>
Borders
Borders are generally used to display an outline around a box or table cell or any other HTML element. In Bootstrap, there are different classes available to add or remove borders. The classes that are used to add borders are referred to as Additive classes and those that are used to remove borders are referred to as subtractive classes.
Class | Description | Syntax
|
---|
Border | Adds a border all around the element.
| .border
|
Border top | Adds a border on top edge of the element.
| .border-top
|
Border right | Adds a border on the right of the element.
| .border-right
|
Border bottom | Adds a border on the bottom of the element.
| .border-bottom
|
Border left | Adds a border on the left of the element.
| .border-left
|
Radius | Makes the corner of the border curved.
| .rounded
|
Color | Used to add color to the border.
| .border-*
|
Example Code:
HTML
<!DOCTYPE html>
<html>
<head>
<title>Borders Example</title>
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<!-- Link Bootstrap JS and JQuery -->
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<style>
/* CSS for Square boxes */
span {
display: inline-block;
width: 70px;
height: 70px;
margin: 6px;
background-color: #DCDCDC;
}
</style>
</head>
<body>
<div class="container">
<h4>Additive Border Classes</h4>
<span class="border border-dark"></span>
<span class="border-top border-dark"></span>
<span class="border-right border-dark"></span>
<span class="border-bottom border-dark"></span>
<span class="border-left border-dark"></span>
</div>
<div class="container">
<h4>Subtractive Border Classes</h4>
<span class="border border-dark"></span>
<span class="border border-0 border-dark"></span>
<span class="border border-top-0 border-dark"></span>
<span class="border border-right-0 border-dark"></span>
<span class="border border-bottom-0 border-dark"></span>
<span class="border border-left-0 border-dark"></span>
</div>
<div>
<h4>Color Border:</h4>
<span class="border border-primary"></span>
<span class="border border-secondary"></span>
<span class="border border-success"></span>
<span class="border border-danger"></span>
<span class="border border-warning"></span>
<span class="border border-info"></span>
<span class="border border-light"></span>
<span class="border border-dark"></span>
</div>
<div>
<h4>Border Radius</h4>
<span class="rounded"></span>
<span class="rounded-top"></span>
<span class="rounded-right"></span>
<span class="rounded-bottom"></span>
<span class="rounded-left"></span>
<span class="rounded-circle"></span>
<span class="rounded-0"></span>
</div>
</body>
</html>
Benefits of Bootstrap Cheat Sheet
- Efficient Web Development: A Bootstrap Cheat Sheet provides a quick reference guide for web developers, enabling faster and more efficient coding. It helps in reducing the time spent on searching for classes or components, thereby increasing productivity.
- Comprehensive Component Reference: The cheat sheet includes an extensive collection of Bootstrap components, classes, and utilities, covering everything from basic typography and buttons to complex components like modals and carousels. This makes it a valuable resource for both beginners and experienced developers.
- Responsive Design: With the inclusion of Bootstrap classes in the cheat sheet, developers can create more responsive and mobile-first web content. It aids in enhancing the user experience and engagement on web pages across different devices.
- Interoperability: Bootstrap is a popular front-end framework. A Bootstrap Cheat Sheet can be beneficial when working with other web technologies like HTML, CSS, JavaScript, and various web development frameworks.
- Optimized for Performance: A well-structured Bootstrap code using the correct classes and components can significantly improve the performance of web applications. The cheat sheet can guide developers in creating performance-optimized web pages.
- Consistency: Bootstrap provides a consistent framework that supports major of all browsers and CSS compatibility fixes. It’s also lightweight and customizable. The cheat sheet can guide developers in creating consistent and uniform web pages.
Remember, using a Bootstrap Cheat Sheet can greatly enhance your web development process, making it a must-have tool for every web developer.
We have Complete tutorial post with the proper roadmap of Bootstrap that includes Bootstrap 4 and Bootstrap 5. This tutorial contains each and every classes of any component with multiple possible examples.
Similar Reads
Bootstrap 5 Tutorial Bootstrap 5 is a front-end framework that helps developers create responsive and visually appealing websites quickly and efficiently. Bootstrap 5 simplifies the process of web development with its intuitive design system and extensive components. This version includes improved responsiveness, stream
6 min read
Bootstrap 5 Introduction Bootstrap is a free and open-source collection of CSS and JavaScript/jQuery code used for creating dynamic websites layout and web applications. Bootstrap is one of the most popular front-end frameworks which has really a nice set of predefined CSS codes. Bootstrap uses different types of classes to
4 min read
Layout
Bootstrap 5 Layout BreakpointsBootstrap 5 layout breakpoints are specific screen widths at which the appearance and behavior of elements on a webpage change. These breakpoints enable responsive design, adjusting content layout and design for various devices, like mobile, tablet, and desktop.Core Concept:Breakpoints in responsive
3 min read
Bootstrap 5 Layout ContainersBootstrap5 Layout Containers are considered the most basic layout that can be used and they can be used to contain other layouts. Containers are basically used to add pad the contents inside or center the items inside the container. In this article, we'll see Bootstrap 5 Layout Containers.Layout Con
3 min read
BootStrap 5 Layout Grid SystemBootStrap5 Layout Grid system is responsive. It comes with a flexbox and allows up to 12 columns across the page. You can also group the columns together. The grid system is a powerful mobile-first responsive flexbox grid. How it works: Hereâs how the grid system comes together: Its grid supports si
3 min read
Bootstrap 5 ColumnsBootstrap 5 Columns facilitates the different option for the alignment, ordering, and offsetting of the Columns with the help of flexbox grid system. The different available column classes can be utilized to manage widths of non-grid elements. Bootstrap 5 Columns: The following components is used th
2 min read
Bootstrap 5 GuttersBootstrap 5 Gutters are used to give padding between columns, responsively space, and align content to the grid system. How gutters works? Using the .padding-right and .padding-left classes, we can add padding to the right and left of each column. Gutters, which are produced by horizontal padding, a
2 min read
Bootstrap 5 UtilitiesBootstrap 5 provides a lot of utilities to make a stylish, mobile-friendly, and responsive front-end website without using any CSS code. The utility layout is used for showing, hiding, aligning, and spacing content. Bootstrap 5 utilities for layout: Changing display: Bootstrap 5 provides some displa
2 min read
Bootstrap 5 Z-indexIn Bootstrap 5, the z-index property controls the stacking order of elements. It defines the depth of an element along the z-axis, determining which elements appear above others. Higher values place elements closer to the foreground, while lower values move them to the background. Bootstrap 5 z-inde
2 min read
Content
Bootstrap RebootBootstrap Reboot is used to reboot all the styles of some specific elements. It normalizes HTML elements with opinionated styles, sets better defaults for <html> and <body> elements, optimizes text rendering with native font stacks, and resets margins, paddings, and other styles for cons
2 min read
Bootstrap 5 TypographyBootstrap 5 Typography styles and formats text, providing customized headings, subheadings, lists, paragraphs, and font styles. It supports global settings for font stack, headings, link styles, ensuring consistency across devices. Here's the information represented in a table format: TermDescriptio
2 min read
Bootstrap 5 ImagesBootstrap 5 provides classes for responsive images, ensuring they scale appropriately within their parent elements, maintaining aspect ratio, and enhancing appearance across devices without overflowing.Types of Images:TermDescriptionResponsive imagesResize images according to parent element and scre
1 min read
Bootstrap 5 TablesBootstrap 5 provides a series of classes that can be used to apply various styling to the tables such as changing the heading appearance, making the rows striped, adding or removing borders, making rows hoverable, etc. Bootstrap also provides classes for making tables responsive. Bootstrap 5 Tables:
2 min read
Bootstrap 5 FiguresA Bootstrap5 Figures is a component that provides a way to display a piece of content along with an image. If we want to show the image with an optional component, the figure class in Bootstrap 5 is used. Bootstrap 5 Figures Classes: figure: used to display content, like any image with an optional c
2 min read
Forms
Bootstrap-5 FormsForm controls: <input>, <select>, <textarea> are the tags used for general appearance like input field, select item and textareas. Â Â Â Note: To make the user interface more presentable, use properties like padding, margins as per the need. Example:Â HTML <!DOCTYPE html> <
2 min read
Bootstrap 5 Form ControlsForm controls like <input>, <select>, <textarea> are the tags used to add custom styles, sizing, focus states to  input field, select item, and text-areas etc. Below are utilities of form control:Sizing: This utility is used to set the label of the form input field in different siz
2 min read
Bootstrap 5 SelectBootstrap 5 Select form is used to create customized select elements with custom CSS that changes the elementâs initial appearance. Bootstrap 5 Select Options: Default: It is used to create a default list of options from which a single option can be selected. To create a select option, we use <se
2 min read
Bootstrap 5 Checks and RadiosBootstrap 5 provides us with utility Checks and radios. This utility is used for creating checkboxes and radio without using CSS.Bootstrap 5 Checks and Radios:Checks: The checkboxes are used for selecting one or several options in a list.Radios: The radios are for selecting one option from many opti
2 min read
Bootstrap 5 RangeBootstrap 5 Range is the limit slider between values that can vary. Bootstrap provides us with a custom range of inputs that provides consistent cross-browser styling. The value and background for the range slider are both styled to look the same across all other browsers. Disabled: It is grayed out
2 min read
Bootstrap 5 Input GroupBootstrap 5 Input Group allows extending the default form controls easily by incorporating text, buttons, or button groups on either side of textual inputs, custom selects, and custom file inputs. Bootstrap 5 facilitates several different components that can be utilized to create the basic Input gro
3 min read
Bootstrap 5 Floating labelsBootstrap 5 floating labels are form labels that float over input fields, improving UX. Wrap form controls like <input>, <label>, <textarea>, <select> inside <div> with class .form-floating. Ensure these elements precede <label> inside the floating <div>.Boo
2 min read
Forms Layout
Bootstrap 5 Layout FormsBootstrap 5 Layout forms provide control of the input field and custom positioning. All the fields should be placed inside the <form> tag. By default the form is aligned vertically as the default value for display is block and is set to 100%. We can use additional classes to change this defaul
2 min read
Bootstrap5 Layout UtilitiesBootstrap 5 Layout Utilities facilitate mobile-friendly, responsive websites. They offer numerous utility classes for tasks like displaying, hiding, aligning, and spacing content, enabling versatile modifications tailored to different design requirements. NameDescriptionChanging displayBootstrap 5 p
2 min read
Bootstrap 5 Layout Form GridBootstrap 5 Layout Form Grid is used to create a complex form using grid classes. The form grid layout required multiple columns of different widths and alignments. To create a form grid, we use .row and .col classes. Form Grid Layout used Classes: .row: This class is used to create a row of a form
2 min read
Bootstrap 5 Layout GuttersGutters are the gaps between the columns in bootstrap's grid layout. The gutter modifier classes can be used to change the widths of the gutters. There are 3 primary gutter modifier classes that are listed below: Bootstrap5 Layout Gutter Modifier Classes: g-*: This class is used to set the width of
2 min read
Bootstrap 5 Layout Horizontal formBootstrap 5 Layout Horizontal form is used to create horizontal forms by using the .row class with .col-*-* classes to specify the width of your labels and controls. Also, use the .col-form-label class with <label> element to set the form label in vertically centered. Layout Horizontal form us
2 min read
Bootstrap 5 Layout Horizontal form label sizingBootstrap 5 Layout Horizontal form label sizing is used to set the label of the form input field in different sizes. To set the label size, use the .col-form-label-sm or .col-form-label-lg class to <label> or <legend> tag with the size of .form-control-lg and .form-control-sm. Horizontal
2 min read
Bootstrap 5 Layout Column sizingBootstrap 5 Layout Column sizing is used to set the width of the column element. To create equal widths columns, .col within .row classes are used. We can also use the subset of classes to set split the columns unequally. Layout Column sizing used Classes: .row: This class is used to create rows for
2 min read
Bootstrap 5 Layout Auto-sizingBootstrap5 layout Auto-sizing dynamically calculates the size height, width, and positions of the elements can be adjusted automatically. It uses a flexbox utility to vertically center the contents and changes .col to .col-auto so that your columns only take up as much space as needed.Bootstrap5 Lay
2 min read
Bootstrap 5 Layout Inline formsBootstrap 5 Layout Inline forms consist of a responsive horizontal layout. All of the elements are inline and left-aligned, and labels are alongside, and only apply to forms within viewports. Bootstrap 5 Layout Inline forms used classes:row-cols-lg-auto: This class is used to create horizontal layou
2 min read
Bootstrap 5 ValidationBootstrap 5 Validation refers to the process of enhancing form input accuracy in web development. It utilizes HTML5 validation features, providing feedback to users regarding input correctness. This feature supports customization with custom styles and JavaScript for improved user experience.Bootstr
4 min read
Components
Bootstrap 5 AccordionBootstrap 5 Accordion organizes content into collapsible panels, enabling space-efficient presentation of information. It allows users to toggle between panel visibility, enhancing user experience, and content organization within web applications. iframe { width: 100%; height: 500px;} @media (max-wi
3 min read
Bootstrap 5 AlertsBootstrap 5 Alerts are customizable components used to convey important information to users. They come in various styles such as success, warning, danger, and info, providing visual feedback to users based on different actions or states within a web application. iframe { width: 100%; height: 450px;
2 min read
Bootstrap 5 BadgesBootstrap 5 Badges are small components used to highlight specific information, typically in lists or inline with other content. They provide visual cues through colored backgrounds and customizable text, helping to draw attention to key details or status indicators within a webpage or application.
2 min read
Bootstrap BreadcrumbBootstrap 5 Breadcrumb simplifies website navigation by displaying a sequential path to the current page. It enhances user experience by visually indicating the hierarchical structure of the site, facilitating easy navigation as per Bootstrap 5 documentation. Bootstrap 5 Breadcrumb TermDescriptionBr
2 min read
Bootstrap 5 ButtonsBootstrap 5 Buttons are pre-styled components in the Bootstrap framework, offering consistent design and functionality. They streamline development by providing ready-to-use button styles, sizes, and behaviors, ensuring a cohesive and responsive user interface across web applications with minimal CS
3 min read
Bootstrap 5 | Button groupBootstrap 5 is the latest major release by Bootstrap in which they have revamped the UI and made various changes. Button group is a component provided by Bootstrap 5 which helps to combine the buttons in a series in a single line. All types of buttons are supported by it. Syntax: <div class="btn-
4 min read
Bootstrap 5 | CardBootstrap 5 is the latest major release by Bootstrap in which they have revamped the UI and made various changes. The card is a component provided by Bootstrap 5 which provides a flexible and extensible content container with multiple variants and options. It includes options for headers and footers
11 min read
Bootstrap 5 CarouselBootstrap 5 Carousel is a slideshow component for cycling through images or slides, allowing users to showcase multiple pieces of content in a visually appealing and interactive way. It offers various options for customization and responsive design.Bootstrap Carousel Classes:ClassDescriptioncarousel
3 min read
Bootstrap 5 | Close buttonBootstrap 5 provides a new component which is a Close button which can be used for dismissing content like modals and alerts. It can be included in the webpage using bootstrap.js or bootstrap.min.js. This component can be combined with models, alerts, and popovers. Disabled close buttons have pointe
1 min read
Bootstrap 5 CollapseBootstrap 5 is the latest major release by Bootstrap in which they have revamped the UI and made various changes. Collapse is used to toggle the visibility of content across your project with a few classes and the JavaScript plugins which comes with Bootstrap 5. The working of collapse component is
3 min read
Bootstrap 5 DropdownsBootstrap 5 is the latest major release by Bootstrap in which they have revamped the UI and made various changes. Dropdowns are toggleable, contextual overlays for displaying lists of links and more. Theyâre made interactive with the included Bootstrap dropdown JavaScript plugin. Theyâre toggled by
9 min read
Bootstrap 5 List groupBootstrap 5 is the latest major release by Bootstrap in which they have revamped the UI and made various changes. List groups are a flexible and powerful component for displaying a series of content. These can be modified and extended to support just about any content within. Use .list-group and .li
5 min read
Bootstrap 5 ModalBootstrap 5 is the latest major release by Bootstrap in which they have revamped the UI and made various changes. Modals are used to add dialogs to your site for lightboxes, user notifications, or completely custom content. Modals are built with HTML, CSS, and JavaScript. Theyâre positioned over eve
7 min read
Navbar
Bootstrap 5 Navbar BrandBootstrap 5 Navbar brand is applied to the typical branding logo that sees in the top navigation bar. It may contain an image logo or text, etc. A Navbar helps readers in selecting topics, links, or sub-topics of their interest. Bootstrap 5 Navbar Brand: Text: The text in the user interface is added
3 min read
Bootstrap 5 Navbar Brand TextA navigation bar is used in every website to make it more user-friendly so that the navigation through the website becomes easy and the user can directly search for the topic of their interest. Navbar Brand Text is used to add text in place of the brand logo. We can write text or links using the nav
2 min read
Bootstrap Navbar Brand ImageBootstrap Navbar Brand Image is used to put the image inside of a navbar, a navigation bar component in the Bootstrap framework. It typically appears at the top of a webpage, serving as a visual identifier for the website or application and linking back to the homepage. Pre-requisite: To use images
2 min read
Bootstrap 5 Navbar NavBootstrap 5 Navbar Nav simplifies navigation creation by grouping navigation links within a container element with the nav class. Use nav-item for each link and nav-link for styling. Customize with optional classes like "active" for the current page. Bootstrap 5 Navbar Nav class: There is no specifi
2 min read
Bootstrap 5 Navbar FormsBootstrap 5 Navbar Forms are used to create the components like a search bar, or login within a navbar. Bootstrap 5 Navbar Forms Classes: No special classes are used in Navbar Forms. You can customize the form using Navbar and Form classes Syntax: <nav class="navbar"> <form> <input cl
2 min read
Bootstrap 5 Navbar TextNavbar Text is used to put some text on the navbar. To do so Bootstrap 5 brings the Bootstrap 5 Navbar Text features. Creating a navbar is obvious when we are creating a website, and putting text on the navbar is required to guide the visitors to the right destination. Navbar Text Class: navbar-text
2 min read
Bootstrap 5 OffcanvasBootstrap is a free and open-source collection of CSS and JavaScript/jQuery code used for creating responsive & dynamic websites layout and web applications. Offcanvas is one of the features of Bootstrap to make web pages more attractive, along with enhancing the user experience.Offcanvas is a s
12 min read
Bootstrap 5 PopoversBootstrap 5 Popovers Provides directional placement options (top, bottom, left, right), dismiss on click, and support for disabled elements. Styled with Sass, they feature various methods, options, and events for dynamic interaction and customization. Bootstrap 5 Popovers: AspectDescriptionFour dire
2 min read
Bootstrap 5 ProgressBootstrap 5 is the latest major release by Bootstrap in which they have revamped the UI and made various changes. A progress bar is used to display the progress of a process on a computer. A progress bar displays how much of the process is completed and how much is left. You can add a progress bar o
5 min read
Bootstrap 5 ScrollspyBootstrap 5 Scrollspy is used to automatically update the navigation links based on the scroll position, highlighting the corresponding section in the viewport.To use scrollspy in Bootstrap 5, we need to add the data-bs-spy="scroll" attribute to the element that should be used for scrolling and spec
4 min read
Bootstrap 5 SpinnersIn this article, we will implement spinners in the website using Bootstrap & will also see the implementation of different types of spinners through the example. The spinners are used to specify the loading state of a component or webpage. Bootstrap facilitates the various classes for creating d
3 min read
Bootstrap 5 ToastsBootstrap 5 Toasts are notifications or messages which the users receive whenever they perform certain actions. They can easily be customized. Overview: Toasts need to be initialized. Apply autohide: false so that the toasts don't automatically hide.Placement: You can place toasts as you want. The t
3 min read
Bootstrap 5 TooltipsA Tooltip is used to provide interactive textual hints to the user about the element when the mouse pointer moves over. The tooltip is quite useful for displaying the description of different elements on the webpage. To create a tooltip, we need to add the data-bs-toggle="tooltip" attribute to an el
3 min read
Helpers
Bootstrap 5 ClearfixBootstrap 5 .clearfix helper class facilitates clearing and fixing the floated content in an element or container by adding the clearfix utility. Basically, without clearfix class, the floated content/elements act like they have a position set to absolute and to fix that, we use the clearfix helper
2 min read
Bootstrap 5 Colored linksBootstrap 5 Colored links are used to add colors to the link element. To set the colored links, we use the classes of utilities built on our theme colors. To make different color links, we will use .link-* class and add CSS styles to it. Colored links used Classes: link-primary: This class is used t
2 min read
Bootstrap 5 RatiosBootstrap 5 provides ratios, which can be used to create fixed-ratio containers. These containers maintain a specific aspect ratio, regardless of the size of the screen or the content within them. Bootstrap 5 Ratios: Aspect ratio: The proportionality between an element's height and breadth is known
2 min read
Bootstrap 5 PositionBootstrap 5 Position offers utility classes to control the positioning of elements. It includes classes like "position-static," "position-relative," "position-absolute," etc., facilitating precise element positioning on web pages for improved layout and design control.NameDescriptionposition-staticD
2 min read
Bootstrap 5 Visually hiddenBootstrap 5 Â Visually hidden are used to visually hide an element so that it does not display on the page while still allowing it to be exposed to assistive technologies. .The visually-hidden class hides the element by default and the visually-hidden-focusable class visually hides an element but dis
2 min read
Bootstrap 5 Stretched linkBootstrap 5 Stretched link is used to make any component clickable. Multiple links are not recommended. The card in bootstrap has position:relative by default, so we can easily add .stretched-link class to a link. Bootstrap 5 Stretched link class: stretched-link: It is added to <a> tag to make
2 min read
Bootstrap 5 Text TruncationBootstrap 5 is a catalog of UI components that enables developers to develop their websites and applications in less time by using the pre-built components and utility classes. This article will see Bootstrap 5 Text truncation.Text Truncation is used to truncate long statements and paragraphs using
2 min read
Extend