Alerts provide contextual feedback messages for typical user actions. For proper styling, use one of the eight required contextual classes. Alerts can also contain additional HTML elements like headings, paragraphs and dividers.

For example,

<div class="alert alert-primary" role="alert">
A simple primary alert!
</div>

1. Link Color

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

<div class="alert alert-success" role="alert">
A simple success alert with <a href="#" class="alert-link">an example link</a>. 
</div>

2. Dismissing Alerts

You need to 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, you can add the .fade and .show classes.

For example,

<div class="alert alert-warning alert-dismissible fade show" role="alert">
This is a dismissible alert.
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>