Seeking guidance on how to center text within my Bootstrap navbar with the following structure:
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid text-center">
<button type="button" id="sidebarCollapse" class="btn btn-info">
<i class="fas fa-align-left" aria-hidden="true"></i>
<span>Toggle Sidebar</span>
</button>
<div class="nav navbar-nav" id="loggedInCheck" style="margin:0 auto;text-align: right !important;display: flex;flex-direction: column;justify-content: right;">
<h3>Text To Center</h3>
</div>
<ul class="nav navbar-nav ml-auto " id="loggedInCheck"
">
<span class="mr-2">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">
<div class="mx-auto d-flex">
<strong id="navUserName">Joe Schmoe</strong>
<a href="/logout"><strong> <i class="fas fa-sync" aria-hidden="true"></i></strong></a>
</div>
</span>
</div>
<select class="defaultPrinter form-control "><option>School</option><option>College</option><option>Office</option></select>
</div>
</span>
</ul>
</div>
</nav>
In order to align the h3 element containing the text "Text To Center", I am exploring options that do not involve absolute positioning due to potential issues on mobile devices where navigation items may overlap. My attempts to use text-align:center
and shifting the text to the right have not yielded the desired result.