×

Html & Html5

The World's best Software Development Study Portal

Bootstrap Spinners


If we want to add any spinner or loader we can add these spinners through .spinner-border class.
Let’s understand this by the following program :-


Basic Spinner


<!DOCTYPE html>

<html lang="en">

<head>

<title> bootstrap 5 Example</title>

<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>

</head>

<body>

<div class="container-fluid">

<h2>Spinners</h2>

<div class="spinner-border"></div>

</div>

</body>

</html>

Output of this Program


bootstrap 5 Example

Spinners

It used to rotate and seems like it is loading.



Color Spinner


We can change the color of the spinner or loader .
Let’s understand them by this program :-


<!DOCTYPE html>

<html lang="en">

<head>

<title> bootstrap 5 Example</title>

<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>

</head>

<body>

<div class="container-fluid">

<h2>colored Spinners</h2>

<div class="spinner-border text-muted"></div>

<div class="spinner-border text-primary"></div>

<div class="spinner-border text-success"></div>

<div class="spinner-border text-info"></div>

<div class="spinner-border text-warning"></div>

<div class="spinner-border text-danger"></div>

<div class="spinner-border text-secondary"></div>

<div class="spinner-border text-dark"></div>

<div class="spinner-border text-light"></div>

</div>

</body>

</html>

Output of this Program


bootstrap 5 Example

colored Spinners

Growing Spinners

<!DOCTYPE html>

<html lang="en">

<head>

<title> bootstrap 5 Example</title>

<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>

</head>

<body>

<div class="container">

<h2>Growing Spinners</h2>

<p>Use the .spinner-grow class if you want the spinner/loader to grow instead of "spin":</p>

<div class="spinner-grow text-muted"></div>

<div class="spinner-grow text-primary"></div>

<div class="spinner-grow text-success"></div>

<div class="spinner-grow text-info"></div>

<div class="spinner-grow text-warning"></div>

<div class="spinner-grow text-danger"></div>

<div class="spinner-grow text-secondary"></div>

<div class="spinner-grow text-dark"></div>

<div class="spinner-grow text-light"></div>

</div>

</body>

</html>

Output of this Program


bootstrap 5 Example

Growing Spinners

Use the .spinner-grow class if you want the spinner/loader to grow instead of "spin":

Spinner Buttons

<!DOCTYPE html>

<html lang="en">

<head>

<title> bootstrap 5 Example</title>

<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>

</head>

<body>

<div class="container">

<h2>Spinner Buttons</h2>

<p>Add spinners to buttons:</p>

<button class="btn btn-primary">

<span class="spinner-border spinner-border-sm"></span>

</button>

<button class="btn btn-primary">

<span class="spinner-border spinner-border-sm"></span>

Loading.. </button>

<button class="btn btn-primary" disabled>

<span class="spinner-border spinner-border-sm"></span>

Loading.. </button>

<button class="btn btn-primary" disabled>

<span class="spinner-grow spinner-grow-sm"></span>

Loading.. </button>

</div>

</body>

</html>

Output of this Program


bootstrap 5 Example

Spinner Buttons

Add spinners to buttons:




Bootstrap 4 training insitute | Best IT Training classes in Gurgaon | Web Designing Training Institute