The excess space within the nav element is due to its padding settings. To resolve this, consider removing the top and bottom padding by applying Bootstrap's spacing utility classes. You can achieve this by adding "px-3 py-0" classes to the nav element.
<nav class="navbar navbar-expand-lg navbar-dark bg-danger fixed-top px-3 py-0"></nav>
You have the flexibility to set the pixel value (px) between 1 to 5.
If you also require a consistent height for the navigation bar, adjust the height property in CSS:
nav {
height: 50px;
}
nav li a {
height: 50px;
line-height: 35px;
}
To ensure that the text aligns centrally within the navigation bar, increase the height of the a element and modify the line-height accordingly.