I'm trying to apply a certain hover
style to all element except the first. For some odd reason :first-child
works, but adding :not(first-child)
doesn't. Why? Full JSFiddle here.
EDIT:
Apparently a small addition of code breaks this style, something I didn't add to the original fiddle because I didn't think It would matter, now I realise it does. Please note that the style does not work when additional tags are located between the a
tags, like so:
<div id="mySidenav" class="sidenav">
<div id="logoContainer">
<a href="https://www.google.com/">
<img src="assets/img/logo_white.png" alt="logo">
</a>
</div>
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<a href="#">About</a>
<a href="#">Services</a>
<a href="#">Clients</a>
<a href="#">Contact</a>
</div>
Working CSS:
.sidenav a:first-child:hover{
color: red;
}
Not working at all CSS:
.sidenav a:not:(first-child):hover{
color: red;
}