I am currently working on applying color changes to the text in my navbar for the links that have been visited, are active, and are being hovered over. I have successfully implemented this for my regular hyperlink elements. However, I am facing an issue with the 'class' descriptor as it is already being used for my dropdown menu button (button class="dropbtn"). I am unsure of how to make the color change when the user is on a page from the dropdown menu or when it has been visited, as the button itself is not technically 'visited', only the links within it.
.dropdown:hover .dropdown-content {
display: block;
}
.dropbtn:hover {
color: #874c16;
font-size: 20px;
}
.dropbtn:visited {
color: #8b4e14;
}
.dropbtn.active {
color: #ffe7d1;
}
.navbar a:hover {
color: #874c16;
font-size: 20px;
}
.navbar a:visited {
color: #8b4e14;
}
.navbar a.active {
color: #ffe7d1;
}
<div class="navbar">
<a href="index.html">Home</a>
<div class="dropdown">
<button class="dropbtn">Cuisine
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
<a href="indian.xml">Indian</a>
<a href="italian.xml">Italian</a>
</div>
</div>
<a href="http://www.blogtyrant.com/best-about-us-pages/">About us</a>
<a href="http://www.blogtyrant.com/best-contact-us-pages/">Contact</a>
<a href="https://media.termsfeed.com/pdf/terms-and-conditions-template.pdf">Terms and Conditions</a>
<a href="https://www.visser.com.au/blog/generic-privacy-policy-for-australian-websites/">Privacy Policy</a>
<a href="datacollect.html">Customer Feedback</a>
</div>
I have been struggling with this issue for quite some time and would greatly appreciate any suggestions or help. Thank you!
Edit: Changing the button class to an anchor class did not resolve the issue as the "cuisine" anchor is never actually clicked, only the anchor elements within it.
Edit 2: To clarify my question, I am looking to change the color of "cuisine" when the user is on the page linked from any of the anchors within it. If they click on "Indian" or "Italian", I want "cuisine" to be a different color compared to when they are on the home page. Additionally, I want "cuisine" to change its default color if it has been visited in the past.