I am trying to center a logo so that it is constantly in the center of my navigation bar, regardless of how many navigation links there are.
This would be easy enough for me if the items at the sides were both even, for example 2 links on the left and 2 on the right, but I'm trying to get 3 on the left and 2 on the right with the centered logo.
Is it possible to center the image using flexbox properties or would I have to go about it a different way, like involving absolute/relative positioning?
header.main-header {
background: url("../images/slides/slide-1.jpg") no-repeat 75%/cover;
height: 100vh;
}
nav.nav-bar {
background-color: tomato;
}
ul.container {
display: flex;
align-items: center;
justify-content: space-around;
padding: 0;
}
ul.container li {
list-style-type: none;
}
li.logo img {
max-width: 125px;
}
<header class="main-header">
<nav class="nav-bar">
<ul class="container">
<li>My Story</li>
<li>Wines</li>
<li>How to Order</li>
<li class="logo"><img src="http://placeimg.com/640/480/any" alt="Wines"></li>
<li>Personal Sommelier</li>
<li>Contact</li>
</ul>
</nav>
<p style="text-align: center;">|<br>(Center)</p>
</header>
Thank you in advance. Have a great day. :)