Bootstrap Alerts - Bootstrap 5 Warning, Info, Success and Error Alerts
Bootstrap Alerts
- Bootstrap Alerts are pre-designed notification components that provide contextual feedback messages to the user, such as success messages, warning messages, error messages, and informational messages, and can be easily customized with different colors and styles using CSS classes.
Sample Code
Output
Bootstrap Alerts Link color
- Use the .alert-link utility class to quickly provide matching colored links within any alert.
Sample Code
Output
Bootstrap Additional content
- Alerts can also contain additional HTML elements like headings, paragraphs and dividers.
Sample Code
Output
Bootstrap Alerts Icon
- Bootstrap Alert with Icon and SVG is a type of alert that includes an SVG icon alongside the message text. SVG icons are vector graphics that can be scaled without losing quality, making them a great option for high-resolution displays.
Sample Code
Output
Bootstrap Alert Dismiss
- Make sure you’ve loaded the alert plugin, or the compiled Bootstrap JavaScript.
- Add a close button and the .alert-dismissible class, which adds extra padding to the right of the alert and positions the close button.
- On the close button, add the data-bs-dismiss="alert" attribute, which triggers the JavaScript functionality. Be sure to use the <button> element with it for proper behavior across all devices.
- To animate alerts when dismissing them, be sure to add the .fade and .show classes.