I am currently in the process of developing a dropdown menu using HTML, CSS, and SCSS.
Any assistance would be greatly appreciated.
<nav>
<div class="nav-container">
<div class="nav-logo">
<a href="index.html"><img class="logo" src="/img/logo.svg" alt="logo"></a>
</div>
<div class="search-container">
<div class="fa fa-search search-icon"></div>
<div class="input-container"><input type="text" placeholder="search"></div>
<div class="fa fa-times cross"> </div>
</div>
<div class="nav-boxes">
<ul>
<div class="nav-link-boxes">
<li class="links"><a href="home.html">home</a></li>
</div>
<div class="nav-link-boxes">
<li class="links"><a href="catalog.html">catalog</a></li>
</div>
<div class="nav-link-boxes dropdown-menu">
<li>
<div class="links"><a href="paintings.html">portfolio</a></div>
</div>
<ul class="dropdown">
<div class="nav-link-boxes dropdown-links">
<li>embroidery</li>
</div>
<div class="nav-link-boxes dropdown-links">
<li>vector</li>
</div>
</ul>
</li>
<div class="nav-link-boxes">
<li class="links"><a href="#">contact</a></li>
</div>
</ul>
</div>
<img class="login" src="./img/accounticon.svg" alt="login">
</div>
</nav>
Sass file
@import "var";
.nav {
&-container {
z-index: 1;
background: $navbar-gradient;
margin-top: 2rem;
width: 95%;
display: flex;
position: fixed;
justify-content: space-between;
align-items: center;
border-radius: 4rem;
height: 6rem;
left: 1.1rem;
.search-container {
display: flex;
align-items: center;
justify-content: space-between;
text-align: center;
background: $search;
padding: 1rem;
border-radius: 2rem;
/* box-shadow: 5px 5px 20px rgb(255, 249, 238); */
input {
display: flex;
margin: auto auto;
margin-left: 1rem;
// /* width:500px; */
border: none;
outline: none;
background: $search;
align-items: center;
justify-content: flex-start;
::placeholder {
color: $placeholder;
}
}
}
.nav-boxes {
ul .boxes {
display: flex;
margin-right: 2rem;
margin-left: 2rem;
align-items: center;
list-style-type: none;
a {
font-family: "Exo 2", sans-serif;
text-decoration: none;
font-size: 1.4rem;
color: $dark-primary;
font-weight: 600;
&:link,
&:visited {
border-radius: 2rem;
transition: all 0.9s;
}
}
}
}
.links {
margin: 0 0.4rem;
}
.nav-link-boxes {
padding: 0.5rem;
margin-right: 0.7rem;
background-color: $nav-buttons;
border-radius: 3rem;
padding-bottom: 0.8rem;
&:hover {
transform: translateY(-0.3rem);
box-shadow: 0 1rem 2rem $white;
}
&:active {
transform: translateY(-0.1rem);
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.3);
}
}
.login {
height: 9rem;
overflow: hidden;
}
}
&-logo {
padding: 1.5rem;
margin-top: 0.5rem;
.logo {
height: 5.2rem;
}
}
}
In the midst of designing a portfolio website, I have introduced a navbar with a dropdown menu placed within the portfolio tab. Each list item has been enclosed within a div so that individual styles can be applied. Wrapping a div around the entire list item results in containment of all items within the nested list, hence the need for this approach.
Utilizing Sass, challenges related to specificity have arisen, hindering the functionality of certain elements. Successfully creating a dropdown menu remains my primary objective amidst these hurdles.