I'm trying to have a section on the navbar dedicated for text or alerts that appear based on certain events. However, even when the alert is hidden, it still affects the height of the navbar. How can I resolve this issue?
It may be difficult to see in the images, but there is a noticeable difference between the popup and when it's closed.
This is utilizing the most recent version of Bootstrap v5.2.3
.navbar-brand img {
height: 50px;
width: 50px;
}
.alert svg {
height: 20px;
width: 20px;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="73111c1c07000701120333465d415d40">[email protected]</a>/dist/css/bootstrap.min.css" />
<nav class="navbar navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="#">
<img src="https://via.placeholder.com/100" alt="Bootstrap" width="30" height="24">
</a>
<span class="navbar-text text-dark" id="wallet_address">
<div class="alert alert-warning d-flex align-items-center alert-dismissible fade show" role="alert">
<svg xmlns="http://www.w3.org/2000/svg" class="bi bi-exclamation-triangle-fill flex-shrink-0 me-2" viewBox="0 0 16 16" role="img" aria-label="Warning:">
<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/>
</svg>
<div>
<strong>ERROR!</strong> No Wallet detected.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
</div>
</span>
</div>
</nav>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ff9d90908b8c8b8b8e95928fbf98939f92">[email protected]</a>/dist/js/bootstrap.bundle.min.js"></script>
edit: updated css and bootstrap version