I had previously inquired about customizing the Bootstrap 5 navbar in this post:
Adjust navbar height to be smaller
and I received some helpful answers. Thank you to everyone who responded. However, I now have a follow-up question:
I am interested in changing the alignment of the links in small view.
Here is my current code snippet:
<header>
<div class="container fixed-top bg-white py-3">
<header class="d-flex flex-wrap justify-content-center">
<a href="/" class="d-flex align-items-center mb-3 mb-md-0 me-md-auto link-body-emphasis text-decoration-none">
<svg class="bi me-2" width="40" height="32"><use xlink:href="#bootstrap"/></svg>
<span class="fs-4">Portfolio</span>
</a>
<ul class="nav nav-pills">
<li class="nav-item"><a href="#" class="nav-link active" aria-current="page">About</a></li>
<li class="nav-item"><a href="#" class="nav-link">PowerPoint</a></li>
<li class="nav-item"><a href="#" class="nav-link">Infographics</a></li>
<li class="nav-item"><a href="#" class="nav-link">Logos and Icons</a></li>
<li class="nav-item"><a href="#" class="nav-link">Web Design</a></li>
<li class="nav-item"><a href="#" class="nav-link">Blog</a></li>
</ul>
</div>
</header>
This is how it currently appears:
https://i.sstatic.net/ppDiB.jpg
I would like to achieve this look instead:
https://i.sstatic.net/T1b6n.jpg
In attempt to address this, I created a separate CSS file for the smallest view with the following adjustments:
@media (min-width: 0px) {
.nav-link-powerpoint{
margin-top: 5px;
margin-left: 86px;
}
.nav-link-infographic {
margin-top: 5px;
margin-left: 39px;
}
While this resolved the horizontal alignment issue:
https://i.sstatic.net/HyPzt.jpg
However, it seems to have affected the vertical alignment and text decorations in this section:
<a href="/" class="d-flex align-items-center mb-3 mb-md-0 me-md-auto link-body-emphasis text-decoration-none">
Is there a way to achieve the vertical alignment as shown here (red line indicating alignment): https://i.sstatic.net/wb7wU.jpg
But without underlining the links. Are there better methods to accomplish this?
Thank you,
--
Updated Screen Capture: https://i.sstatic.net/OvXcrG18.jpg