While attempting to utilize flexbox for creating a navbar with the logo in the center, I encountered an issue where the logo wasn't able to overflow from above and below the navbar.
I experimented with squeezing in and positioning the element, but it seemed like a suboptimal solution that would complicate coding responsiveness.
HTML
<template>
<v-toolbar class="nav_container" color="#000000" flat height="80px">
<v-toolbar-items class="nav-items-left">
<NuxtLink class="home-link" to="/">Home</NuxtLink>
<NuxtLink class="nomination-link" to="/">Nomination</NuxtLink>
<NuxtLink class="prev-link" to="/">Previous Rounds</NuxtLink>
</v-toolbar-items>
<div class="logo-container">
<img src="../static/award-logo.svg" alt="John" class="logo" />
</div>
<v-toolbar-items class="nav-items-right">
<NuxtLink class="media-link" to="/">Media Center</NuxtLink>
<NuxtLink class="about-link" to="/">About</NuxtLink>
<NuxtLink class="contactus-link" to="/">Contact Us</NuxtLink>
</v-toolbar-items>
</v-toolbar>
</template>
scss:
.nav_container {
width: 100%;
position: relative;
.nav-items-left {
display: flex;
justify-content: space-evenly;
align-items: center;
width: 100%;
.home-link {
color: #ba9d29;
text-decoration: none;
font-size: 20px;
&:hover {
transform: scale(1.2);
}
}
.nomination-link {
color: #ba9d29;
text-decoration: none;
font-size: 20px;
&:hover {
transform: scale(1.2);
}
}
.prev-link {
color: #ba9d29;
text-decoration: none;
font-size: 20px;
&:hover {
transform: scale(1.2);
}
}
}
.nav-items-right {
display: flex;
justify-content: space-evenly;
align-items: center;
width: 100%;
.about-link {
color: #ba9d29;
text-decoration: none;
font-size: 20px;
&:hover {
transform: scale(1.2);
}
}
.media-link {
color: #ba9d29;
text-decoration: none;
font-size: 20px;
&:hover {
transform: scale(1.2);
}
}
.contactus-link {
color: #ba9d29;
text-decoration: none;
font-size: 20px;
&:hover {
transform: scale(1.2);
}
}
}
.logo-container {
position: absolute;
height: 200px;
width: 200px;
left: 43.5%;
.logo {
&:hover {
transform: scale(1.2);
}
}
}
}
Could you suggest a better approach to achieve this? Here's an image illustrating what I'm trying to accomplish: https://i.stack.imgur.com/hmGaA.jpg
Code after fixing by @LMichiels
HTML
<template>
<v-toolbar class="nav_container" color="#000000" flat height="80px">
<v-toolbar-items class="nav-items">
<NuxtLink class="home-link" to="/">Home</NuxtLink>
<NuxtLink class="nomination-link" to="/">Nomination</NuxtLink>
<NuxtLink class="prev-link" to="/">Previous Rounds</NuxtLink>
<img
src="../static/award-logo.svg"
alt="John"
class="logo"
height="200px"
/>
<NuxtLink class="media-link" to="/">Media Center</NuxtLink>
<NuxtLink class="about-link" to="/">About</NuxtLink>
<NuxtLink class="contactus-link" to="/">Contact Us</NuxtLink>
</v-toolbar-items>
</v-toolbar>
</template>
SCSS
.nav_container {
width: 100%;
position: relative;
height: 125px;
.nav-items {
display: flex;
justify-content: space-evenly;
align-items: center;
width: 100%;
height: 0;
.home-link {
color: #ba9d29;
text-decoration: none;
font-size: 20px;
&:hover {
transform: scale(1.2);
}
}
.nomination-link {
color: #ba9d29;
text-decoration: none;
font-size: 20px;
&:hover {
transform: scale(1.2);
}
}
.prev-link {
color: #ba9d29;
text-decoration: none;
font-size: 20px;
&:hover {
transform: scale(1.2);
}
}
.about-link,
.media-link,
.contactus-link,
.logo {
color: #ba9d29;
text-decoration: none;
font-size: 20px;
&:hover {
transform: scale(1.2);
}
}
}
}