VOOZH about

URL: https://www.geeksforgeeks.org/bootstrap/bootstrap-5-alerts/

⇱ Bootstrap 5 Alerts - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Bootstrap 5 Alerts

Last Updated : 3 Apr, 2024

Bootstrap 5 Alerts are customizable components used to convey important information to users. They come in various styles such as success, warning, danger, and info, providing visual feedback to users based on different actions or states within a web application.

Syntax:

<div class="alert alert-type"> Contents of the alert... <div>

Types: There are eight types of alerts available in Bootstrap 5. The classes of these alerts are given below:

  • alert-primary
  • alert-secondary
  • alert-success
  • alert-danger
  • alert-warning
  • alert-info
  • alert-light
  • alert-dark

Example 1: This example we demonstrates Bootstrap 5 alerts with different colors: primary, secondary, success, and danger, each displaying "GeeksforGeeks" as content.

Output:

👁 Image

Example 2: In this example we features Bootstrap 5 alerts styled as warning, info, light, and dark, displaying "GeeksforGeeks" as content within a centered container.

Output:

👁 Image

Comment
Article Tags:

Explore