As a newbie to using bootstrap 4 for the first time, I expected vertical alignment of elements to be easy, especially with flex being touted as the simplest way to achieve this.
The issue: Struggling to vertically align my form element within my navigation bar. When I adjust the font size of the text input element, it shrinks and loses its vertical alignment:https://i.sstatic.net/53XcK.png
My HTML:
<nav class="navbar navbar-toggleable-md py-3 navbar-dark">
<div class="container">
<div class="d-flex justify-content-between"><a class="navbar-brand" href="/">TMS</a><button class="navbar-toggler collapsed" type="button" data-toggle="collapse" data-target="#bd-main-nav" aria-controls="bd-main-nav" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button></div>
<div class="navbar-collapse collapse" id="bd-main-nav" aria-expanded="false">
<ul class="nav navbar-nav right-spacer">
<li class="nav-item"><a class="nav-item nav-link" href="/features">Features</a></li>
<li class="nav-item"><a class="nav-item nav-link" href="/features">Demo</a></li>
<li class="nav-item"><a class="nav-item nav-link" href="/pricing">Pricing</a></li>
<li class="nav-item"><a class="nav-item nav-link" href="/contact">Contact</a></li>
<form class="navbar-form" role="search"><input class="header-search-input form-control" type="text" placeholder="Search projects" name="q"></form>
<li class="nav-item"><a class="nav-item nav-link" href="/login/">Sign in</a></li>
</ul>
</div>
</div>
</nav>
The custom CSS:
.navbar-dark .header-search-input {
background-color: #fafafa;
font-size: .7rem;
}
Fiddle: https://jsfiddle.net/qo33wf3d/ (Resize the output window otherwise it will show the empty responsive version)