Provide contextual feedback messages for typical user actions. Read the Official Bootstrap Documentation for a full list of instructions and other options.
Alerts are available for any length of text, as well as an optional dismiss button. For proper styling, use one of the eight required contextual classes.
<div class="alert alert-primary" role="alert">...</div>
<div class="alert alert-secondary" role="alert">...</div>
<div class="alert alert-success" role="alert">...</div>
<div class="alert alert-danger" role="alert">...</div>
<div class="alert alert-warning" role="alert">...</div>
<div class="alert alert-info" role="alert">...</div>
<div class="alert alert-light" role="alert">...</div>
<div class="alert alert-dark" role="alert">...</div>
Use the .alert-link
utility class to quickly provide matching colored links within any alert.
<div class="alert alert-primary mg-b-0" role="alert">
A simple primary alert with <a href="#" class="alert-link">an example link</a>.
Give it a click if you like.
</div>
Alerts can also contain additional HTML elements like headings, paragraphs and dividers.
Aww yeah, you successfully read this important alert message. This example text is going to run a bit longer so that you can see how spacing within an alert works with this kind of content.
Whenever you need to, be sure to use margin utilities to keep things nice and tidy.
<div class="alert alert-success" role="alert">
<h4 class="alert-heading">Well done!</h4>
<p>Aww yeah, you successfully read this important alert message. This example text is going to run a bit longer so that you can see how spacing within an alert works with this kind of content.</p>
<hr>
<p class="mb-0">Whenever you need to, be sure to use margin utilities to keep things nice and tidy.</p>
</div>
Using the alert JavaScript plugin, it’s possible to dismiss any alert inline. Add a dismiss button and the .alert-dismissible
class, which adds extra padding to the right of the alert and positions the .close
button.
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<strong>Holy guacamole!</strong> You should check in on some of those fields below.
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
An outline style variant with a little thicker border and a little thicker font weight with both border and text have the same color. Use one of the four required contextual classes.
<div class="alert alert-outline alert-primary" role="alert">...</div>
A solid background style variant with white text and without border. Use one of the four required contextual classes.
<div class="alert alert-solid alert-primary" role="alert">...</div>
Adding icon to different alert variant using additional class of .d-flex
and .align-items-center
.
<div class="alert alert-primary d-flex align-items-center" role="alert">
<i data-feather="alert-circle" class="mg-r-10"></i> A primary alert—check it out!
</div>