My question is about navigation bar styling and layout using flex.
I am attempting to create a fixed navigation bar where the logo/link to the home is left justified, with the rest of the links right justified. I have been trying to accomplish this with flex using the CSS styling of flex-direction:row and row-reverse, and justify-content: flex-start and flex-end with little success.
How can I achieve this look using flex?
.header {
display: flex;
width: 100vw;
padding: 0;
margin: 0;
}
.fixednav {
display: flex;
flex-direction: row;
position: fixed;
top: 0;
left: 0;
z-index: 9999;
width: 100%;
height: 60px;
background-color: rgba(0, 0, 0, 1);
}
.leftnav {
position: absolute;
flex-direction: row;
justify-content: flex-start;
}
.rightnav {
position: absolute;
justify-content: flex-end;
flex-direction: row-reverse;
}
<div class="header">
<header>
<div class="navcontainer">
<nav class="fixednav">
<div class="leftnav"><a href="#">logo</a></div>
<div class="rightnav"><a href="#" class="rightnav">home</a></div>
<div class="rightnav"><a href="#" class="rightnav">profile</a></div>
<div class="rightnav"><a href="#" class="rightnav">contact</a></div>
</nav>
</div>
</header>
</div>