bootstrap alert auto close

To automatically close a Bootstrap alert, you can use JavaScript. Here's an example of how you can achieve this:

<div class="alert alert-success alert-dismissible fade show" role="alert">
  This is a success alert!
  <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>

<script>
  // Automatically close the alert after 3 seconds
  setTimeout(function() {
    document.querySelector('.alert').remove();
  }, 3000);
</script>

In this example, the alert has the class "alert-dismissible" to display the close button. The JavaScript code uses the setTimeout function to remove the alert element from the DOM after 3 seconds. You can adjust the time delay by changing the value inside the setTimeout function.

Please note that this code assumes you have included the necessary Bootstrap and JavaScript libraries in your project.