I've got a flex container, with a logo and some links. I want the logo to be centered, and the links over on the right. The best I can seem to do is center the logo in the remaining space, which is not centered on the container.
Here are some of my attempts so far:
.header{background:#CCC;padding:1rem; margin-bottom:2rem;}
.logo{background:skyblue;text-align:center;height:30px;width:200px;}
/*-----------------------*/
#header1 {
display: flex;
justify-content: space-between;
align-items: center;
}
#header1-logo {
justify-self: center;
}
#header1-nav {
justify-self: flex-end;
}
/*-----------------------*/
#header2 {
display: flex;
justify-content: center;
align-items: center;
}
#header2-logo {
margin: 0 auto;
}
<header id="header1" class="header">
<div id="header1-logo" class="logo">LOGO</div>
<nav id="header1-nav">
<a href="#">foo</a>
<a href="#">bar</a>
<a href="#">baz</a>
</nav>
</header>
<header id="header2" class="header">
<div id="header2-logo" class="logo">LOGO</div>
<nav id="header2-nav">
<a href="#">foo</a>
<a href="#">bar</a>
<a href="#">baz</a>
</nav>
</header>