I recently implemented flexbox with align-items-stretch to ensure the borders extend to the top and bottom. However, I am now facing a challenge with vertically aligning the text within the flexbox. Due to restrictions on using margins and paddings, I cannot easily resolve this conflict. Do you have any suggestions on how to achieve vertical alignment without causing property clashes?
I attempted to use align-items-stretch and added an align-middle class within the ul li
, but it did not produce the desired result and seemed to create a property conflict.
<div class="navbar-collapse collapse align-items-stretch" id="navbarCollapse" style="">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">Home</li>
<li class="nav-item">About Us</li>
<li class="nav-item ">Services</li>
</ul>
</div>
While the current code successfully stretches the borders, it does not centralize the text within the flexbox.