Alerts

Provide contextual feedback messages for typical user actions with the handful of available and flexible alert messages.

Examples

Alerts are available for any length of text, as well as an optional dismiss button. For proper styling, use one of the eight required contextual classes (e.g.,
.alert-success). For inline dismissal, use the
alerts jQuery plugin.

This is a primary alert—check it out!

This is a info alert—check it out!

This is a success alert—check it out!

This is a danger alert—check it out!

This is a warning alert—check it out!

This is a rose alert—check it out!

<divclass="alert alert-primary"role="alert">
This is a primary alert—check it out!
</div><divclass="alert alert-info"role="alert">
This is a info alert—check it out!
</div><divclass="alert alert-success"role="alert">
This is a success alert—check it out!
</div><divclass="alert alert-danger"role="alert">
This is a danger alert—check it out!
</div><divclass="alert alert-warning"role="alert">
This is a warning alert—check it out!
</div><divclass="alert alert-rose"role="alert">
This is a rose alert—check it out!
</div>

Link color

Use the
.alert-link utility class to quickly provide matching colored links within any alert.

<divclass="alert alert-primary"role="alert">
This is a primary alert with <ahref="#"class="alert-link">an example link</a>. Give it a click if you like.
</div><divclass="alert alert-info"role="alert">
This is a info alert with <ahref="#"class="alert-link">an example link</a>. Give it a click if you like.
</div><divclass="alert alert-success"role="alert">
This is a success alert with <ahref="#"class="alert-link">an example link</a>. Give it a click if you like.
</div><divclass="alert alert-danger"role="alert">
This is a danger alert with <ahref="#"class="alert-link">an example link</a>. Give it a click if you like.
</div><divclass="alert alert-warning"role="alert">
This is a warning alert with <ahref="#"class="alert-link">an example link</a>. Give it a click if you like.
</div><divclass="alert alert-rose"role="alert">
This is a rose alert with <ahref="#"class="alert-link">an example link</a>. Give it a click if you like.
</div>

Dismissing

Be sure you’ve loaded the alert plugin, or the compiled Bootstrap JavaScript.

If you’re building our JavaScript from source, it
requires
util.js. The compiled version includes this.

Add a dismiss button and the
.alert-dismissible class, which adds extra padding to the right of the alert and positions the
.close button.

On the dismiss button, add the
data-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.

You can see this in action with a live demo:

Holy guacamole! You should check in on some of those fields below.

<divclass="alert alert-warning alert-dismissible fade show"role="alert"><strong>Holy guacamole!</strong> You should check in on some of those fields below.
<buttontype="button"class="close"data-dismiss="alert"aria-label="Close"><spanaria-hidden="true">&times;</span></button></div>