Bootstrap 4 Alerts
Display pre-styled alerts and messages for common user actions.
Bootstrap provides an easy way to create a stylized alert message box with its alert component.
To create an alert box, use the .alert
class along with one of the .alert-*
classes to specify the kind of alert.
Dismissible Alerts
You can create dismissible alerts by adding Bootstrap's .alert-dismissible
class, along with a Close button. When the user clicks the Close button, the alert disappears.
Here we use ×
to create the Close icon (×).
Fading Effect
You can give the alert a slight fading effect when closing them by adding the .fade
and .show
classes.
Alerts with Links
Use Bootstrap's .alert-link
class on the <a>
tag to match link color with the text.