I'm trying to use the pseudo class :nth-child() with :hover but it seems to not work for me. I am trying to change the colour of one element to green when hovered over, but it highlights all of them. I also tried without the hover and none of the colours change.
ul {
background-color: white;
text-decoration: none;
padding: 0;
margin: 0 auto;
}
ul li {
margin: 0 2em;
display: inline-block;
padding: 0;
list-style: none;
}
ul li a {
text-decoration: none;
color: black;
}
a:nth-child(2){
color: green;
}
<ul>
<li><a href="#">Easy</a></li>
<li><a href="#">Medium</a></li>
<li><a href="#">Hard</a></li>
<li><a href="#">Insane</a></li>
</ul>