I want to change the color of the link when I hover the mouse over the part created by li:before selector. Here is the snippet
ul li {
display: inline-block;
float: right;
margin: 10px 55px 0px 55px;
font-size: 35px;
position: relative;
top: -26px;
left: -10%;
height: 100%;
transition: 0.5s ease;
font-family: impact;
letter-spacing: 2;
}
ul li:before {
content: "";
position: absolute;
width: 100%;
height: 7px;
bottom: 0;
left: 0;
background-color: red;
visibility: hidden;
-webkit-transform: scaleX(0);
-moz-transform: scaleX(0);
-webkit-transition: all 0.25s ease-in-out 0s;
-moz-transition: all 0.`25s ease-in-out 0s;
}
a {
text-decoration: none;
display: block;
color: black;
}
a:hover {
color: red;
}
ul li:hover:before {
visibility: visible;
-webkit-transform: scaleX(1);
-moz-transform: scaleX(1);
}
ul li:hover {
background-color: yellow;
-webkit-transition: background-color 0s;
-moz-transition: background-color 0s;
color: red;
}
<ul>
<li><span><a href="">HOME</a></span>
</li>
<li><span><a href="">PLACES TO VISIT</a></span>
</li>
<li><span><a href="">STATISTICS</a></span>
</li>
<li><span><a href="">GALLERY</a></span>
</li>
</ul>
Here, when the mouse is hovered over the text, the color changes and an underline appears which was there initially but hidden. That underline is made by the li:before selector. When I hover the mouse over that underline, the color of the text changes back to white (which i don't want). How can I prevent this color change?