Having trouble with the nth-child property.
The issue lies with the #subnav
element. I'm unsure why nth-child isn't working as expected (supposed to change border color and width).
Here's the problem and code snippet :
<div class="container">
<!-- subnav -->
<ul id="subnav">
<li><a href=""><span>Philosophie</span></a></li>
<li><a href=""><span>Musiciens</span></a></li>
<li><a href=""><span>Programmes</span></a></li>
<li><a href=""><span>Médias</span></a></li>
<li><a href=""><span>Agenda</span></a></li>
</ul>
and the sass portion
.container {
#subnav {
margin-top: 2rem;
display: flex;
justify-content: space-evenly;
li {
padding-bottom: 0.5rem;
border-bottom: 4px 0.5rem;
border-color: solid #f36e52;
}
a {
color: #fff;
text-decoration: none;
span:nth-child(1):after, span:nth-child(2):after{
content: '';
height: 4px;
text-align: right;
float:right;
margin-top: 0.3rem;
}
span:nth-child(1):after {
width: 30%;
background-color: #f36e52;
}
span:nth-child(2):after {
content: '';
width: 100%!important;
background-color: #fff555;
}
}
}
}
Looking to adjust the width and color of each link, currently only affecting span:nth-child(1)
.
Any suggestions? Appreciate the help.