While working on a website using bootstrap, I encountered an issue with responsiveness when adjusting the text size and gap of the navigation items. By increasing the size and adding a gap through fs-4
and style="gap: 10vh;"
, the default small size of the bootstrap navbar became non-responsive on smaller screens.
<body>
<header class="header">
<nav class="p-nav navbar navbar-expand-sm navbar-light border " >
<div class="container-fluid">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav m-auto mb-0 mb-lg-0 d-flex justify-content-between " style="gap: 10vh;" >
<li class="nav-item fs-4">
<a class="nav-link " aria-current="page" href="#" >Home</a>
</li>
...
</ul>
</div>
</div>
</nav>
</header>
<img src="assets/car(container).gif" alt="" class="img-fluid img-cc">
<script src="https://cdn.jsdelivr.net/npm/@popperjs/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0f6c607d6a4f3d2136213d">[email protected]</a>/dist/umd/popper.min.js"
integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="492b26262d2a2d2b2839097c6779677b">[email protected]</a>/dist/js/bootstrap.min.js"
integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF"
crossorigin="anonymous"gt;</script>
</body>
View image before changing size and gap
Here is the image after adding gap and increasing size Image without gap
I attempted to use custom CSS along with other bootstrap utilities but the responsiveness issue persists.