I am facing a challenge in designing a navigation bar where the brand logo is on the left, while the navigation links are placed on the right. Currently, the links appear stacked on top of each other instead of side by side:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="#">Peek Solutions</a>
<div class="navbar-nav justify-content-end">
<a class="nav-item nav-link" href="#">About</a>
<a class="nav-item nav-link" href="#">Services</a>
<a class="nav-item nav-link" href="#">Contact</a>
</div>
</nav>
I've attempted to align them to the right using .justify-content-end
as per the documentation at https://getbootstrap.com/docs/4.0/components/navs/, but the result doesn't meet my expectations. (I also investigated the Bootstrap 4 source code without identifying the issue quickly).
Update
If I use the snippet below,
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="#">Peek Solutions</a>
<div class="navbar justify-content-end">
<a class="nav-item nav-link" href="#">About</a>
<a class="nav-item nav-link" href="#">Services</a>
<a class="nav-item nav-link" href="#">Contact</a>
</div>
</nav>
then the layout is correct (refer to https://jsfiddle.net/qxdsam8t/10/) but the link colors revert to default blue rather than the light gray theme color. Adding the class navbar-nav
to the inner div
restores the theme colors but results in the display being 'stacked' like initially observed. It appears that these properties are linked together; how can I retain the colors without stacking?