Bootstrap snippet and html example. Custom alert boxes

Bootstrap 5.1.3 snippet "Custom alert boxes" with HTML, CSS, and JS. Copy, paste, and customize this responsive UI component for your project.

HTML code

Clean, semantic HTML that powers this Bootstrap 5.1.3 snippet. Copy and paste it into your page (with Bootstrap loaded) to reproduce the exact layout shown in the preview.


  <!-- created by @BrCodeSnippets -->

  <div class="container mt-3 pt-3">
<div class="row">
<div class="col-12">
  <div class="border-start border-4 border-primary ps-3 p-3 my-3 alert-primary shadow" role="alert">
A simple shadow primary alert—check it out!
</div>
<div class="border-start border-4 border-secondary ps-3 p-3 my-3  alert-secondary" role="alert">
A simple secondary alert—check it out!
</div>
<div class="border-start border-4 border-success ps-3 p-3 my-3  alert-success" role="alert">
A simple success alert—check it out!
</div>
<div class="border-start border-4 border-danger ps-3 p-3 my-3  alert-danger shadow" role="alert">
A simple danger alert—check it out!
</div>
<div class="border-start border-4 border-warning border-end ps-3 p-3 my-3  alert-warning" role="alert">
A simple warning alert—check it out!
</div>
<div class="border-start border-4 border-info ps-3 p-3 my-3  alert-info" role="alert">
A simple info alert—check it out!
</div>
<div class="border-start border-4 border-dark ps-3 p-3 my-3  alert-light" role="alert">
A simple light alert—check it out!
</div>
<div class="border-start border-4 border-end border-secondary ps-3 p-3 my-3  alert-dark" role="alert">
A simple dark alert—check it out!
</div>
</div>
</div>
  </div>

CSS code

Scoped CSS that styles the component. Paste it after Bootstrap 5.1.3 to keep the design, spacing, and responsiveness consistent.

body{margin-top:20px;}

Similar snippets

Bootstrap example and template. light user profile

light user profile

Bootstrap example and template. profile tab widget

profile tab widget

Bootstrap example and template. animated chat window

animated chat window

Bootstrap example and template. page loader

page loader

Bootstrap example and template. view user information

view user information

Bootstrap example and template. facebook messenger chat

facebook messenger chat

Bootstrap example and template. Get in Touch form

Get in Touch form

Bootstrap example and template. top item list

top item list

FAQ

How do I use this snippet?

Include Bootstrap 5.1.3, paste the HTML, add the CSS block, and include the JS (if any) to mirror the live preview.

Can I use it in commercial projects?

Yes. It’s free for personal and commercial work; check the snippets license for details.

Is it responsive?

Yes. It inherits the responsive grid and components from Bootstrap 5.1.3.

Bootstrap example and template. Custom alert boxes

About this bootstrap example/template

Optimized for copy‑paste: clean HTML, scoped CSS, and minimal JS so you can ship production‑ready UI faster and keep designs consistent.

Mobile‑first and responsive by default. Tested across modern browsers to reduce polish time on your project.

Already trusted in 454+ views. Reuse this snippet to speed up landing pages, dashboards, or onboarding flows.

Bootstrap 5.1.3

<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css'>

<script src='https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js'></script>

This code example is based on bootstrap 5.1.3 and the grid system of this framework

Responsive

Based on bootstrap framework makes all the layouts perfectly responsive for all devices

Crossbrowser compatibility

Tested on all major browsers, it works smoothly on all of them

semantic html 5

Built on html / css3 the code quality is really amazing

Simple Integration

This code example can be simply integrated on existing sites and new ones too, all you need to do is copy the code and start working