Bootstrap Alerts

Bootstrap Alerts allow you to display important messages to users such as warnings, success messages, errors, or information.


Basic Alert

Bootstrap provides different alert classes:

Class Meaning
alert-success Indicates success (green)
alert-info Informational message (blue)
alert-warning Warning (yellow)
alert-danger Error or danger (red)
alert-primary, alert-secondary, etc. (Bootstrap 4+) Additional styles

Example:



 

 

 

 


🚫 Dismissible Alert (Close Button)

You can add a close button so users can dismiss alerts.



 


⚠️ Alert with Links

To make links in alerts match the alert style, use alert-link.



 


🎯 Alert with Additional Content (Heading + Text)



 


🔔 JavaScript Custom Alerts (Optional)

Bootstrap alert events can be handled using JS:



 


📌 Summary

Feature Supported
Basic alert messages ✔️
Dismissible alerts ✔️
Alerts with links ✔️
Alerts with headings ✔️
Custom JS alert events ✔️

You may also like...