Bootstrap Alerts
Bootstrap alerts are used to display important information to users. They are customizable and can be styled to fit the design of your website.
Syntax
To create an alert in Bootstrap, you need to use the following HTML syntax:
<div class="alert alert-primary" role="alert">
This is a primary alert—check it out!
</div>
In the example above, we used the alert
class and the alert-primary
class to create a primary alert.
You can also add more classes to modify the alert's appearance. For example, you can use the alert-dismissible
class to add a close button to the alert:
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<strong>Warning!</strong> This is a warning alert—check it out!
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>