Bootstrap Home
Alerts
Alerts are created with the .alert class, followed by a contextual color class.
Success! This alert box could indicate a successful or positive action.
Info! This alert box could indicate a neutral informative change or action.
Warning! This alert box could indicate a warning that might need attention.
Danger! This alert box could indicate a dangerous or potentially negative action.
Primary! Indicates an important action.
Secondary! Indicates a slightly less important action.
Dark! Dark grey alert.
Light! Light grey alert.
Alert Links
Add the alert-link class to any links inside the alert box to create "matching colored links".
Closing Alerts
The button with class="btn-close" and data-bs-dismiss="alert" is used to close the alert box.
The alert-dismissible class aligns the button to the right.
Success! This alert box could indicate a successful or positive action.
Info! This alert box could indicate a neutral informative change or action.
Warning! This alert box could indicate a warning that might need attention.
Danger! This alert box could indicate a dangerous or potentially negative action.
Primary! Indicates an important action.
Secondary! Indicates a slightly less important action.
Dark! Dark grey alert.
Light! Light grey alert.
Animated Alerts
The .fade and .show classes adds a fading effect when closing the alert message.
Success! This alert box could indicate a successful or positive action.
Info! This alert box could indicate a neutral informative change or action.
Warning! This alert box could indicate a warning that might need attention.
Danger! This alert box could indicate a dangerous or potentially negative action.
Primary! Indicates an important action.
Secondary! Indicates a slightly less important action.
Dark! Dark grey alert.
Light! Light grey alert.
Live Example
Click the button below to show an alert (hidden with inline styles to start), then dismiss (and destroy) it with the built-in close button.
Additional Content
Alerts can also contain additional HTML elements like headings, paragraphs and dividers.
Additional Info!
For additional content that runs longer than the standard messages, spacing within an alert can make the text more readable.
Margin utilities allow for a clean presentation.
Icons
Similarly, you can use flexbox utilities and Bootstrap Icons to create alerts with icons.
An example alert with an icon
An example success alert with an icon
An example warning alert with an icon
An example danger alert with an icon