I have these 3 triangles and each one of them is next to a navbar link. I want to be able to hover over the navbar link and make the triangle appear next to it. So far I cannot get it to appear and I have no clue why. I am new to scss so maybe that is why I am not getting it. I had to use visibility: hidden because if I use display none, it will take away the margins that are a necessity.
<!--desktop nav-->
<nav >
<div >
<div >
<div >
<img src="./img/neon-pink.png" >
<a id="about-hover" href="about.html">About</a>
</div>
<div >
<img src="./img/neon-pink.png" >
<a id="work-hover" href="work.html">Work</a>
</div>
<div >
<img src="./img/neon-pink.png" >
<a id="contact-hover" href="#">Contact</a>
</div>
<!--social-->
<div >
<a target="_blank" href="https://github.com/"><i
></i></a>
<a target="_blank" href="https://www.linkedin.com/"><i
></i></a>
</div>
</div>
</div>
</nav>
a {
font-family: $ff-secondary;
text-decoration: none;
color: white;
}
#header {
.navbar-desktop {
.container {
justify-content: end;
.navbar-menu {
display: flex;
justify-content: flex-end;
padding-top: 16px;
font-size: 1.75rem;
.nav-items {
display: flex;
align-items: center;
.about-bullet,
.work-bullet,
.contact-bullet {
width: 24px;
height: 24px;
margin-right: 8px;
transform: rotate(180deg);
visibility: hidden;
}
a {
margin-left: 0;
margin-right: 64px;
text-shadow: 0 0 20px #fff;
}
}
#about-hover:hover .about-bullet {
visibility: visible;
}
.social-container {
margin-right: 16px;
display: flex;
a {
margin: 0 8px;
}
i {
font-size: 2.15rem;
}
}
}
}
}
}
CodePudding user response:
The IMG-tag is not a child of the #about-hover, so having a hover on it has no effect.
The hover would need to be on the nav-items
.
a {
font-family: $ff-secondary;
text-decoration: none;
color: #fff;
}
#header {
.navbar-desktop {
.container {
justify-content: end;
.navbar-menu {
display: flex;
justify-content: flex-end;
padding-top: 16px;
font-size: 1.75rem;
.nav-items {
display: flex;
align-items: center;
.about-bullet,
.work-bullet,
.contact-bullet {
width: 24px;
height: 24px;
margin-right: 8px;
transform: rotate(180deg);
visibility: hidden;
}
a {
margin-left: 0;
margin-right: 64px;
text-shadow: 0 0 20px #fff;
}
&:hover {
.about-bullet,
.work-bullet,
.contact-bullet {
visibility: visible;
}
}
}
.social-container {
margin-right: 16px;
display: flex;
a {
margin: 0 8px;
}
i {
font-size: 2.15rem;
}
}
}
}
}
}
CodePudding user response:
You mean something like this?
i {
font-size: 2.15rem;
}
a {
text-decoration: none;
color: white;
text-shadow: 0 0 20px #fff;
background: rgb(189, 184, 184);
}
.container {
justify-content: end;
}
.nav-items {
display: flex;
align-items: center;
gap: 5px;
}
.nav-items:hover .arrow {
visibility: visible;
}
.arrow {
visibility: hidden;
transform: rotate(90deg);
width: 24px;
height: 24px;
}
.navbar-menu {
display: flex;
justify-content: flex-end;
padding-top: 16px;
font-size: 1.75rem;
gap: 10px;
}
.social-container {
margin-right: 16px;
display: flex;
}
<nav >
<div >
<div >
<div >
<img src="https://svgsilh.com/svg/146916.svg" />
<a id="about-hover" href="about.html">About</a>
</div>
<div >
<img src="https://svgsilh.com/svg/146916.svg" />
<a id="work-hover" href="work.html">Work</a>
</div>
<div >
<img src="https://svgsilh.com/svg/146916.svg" />
<a id="contact-hover" href="#">Contact</a>
</div>
<!--social-->
<div >
<a target="_blank" href="https://github.com/"><i ></i></a>
<a target="_blank" href="https://www.linkedin.com/"><i ></i></a>
</div>
</div>
</div>
</nav>