For a personal project I am currently working on, I decided to experiment with setting background colors using Javascript. However, I have encountered an issue where my CSS code that changes the hover
property does not seem to work after implementing the Javascript.
Below is the Javascript code that is functioning correctly:
titles.forEach(titles => {
document.getElementById(titles).style.backgroundColor = "#7dd5f8";
document.getElementById(titles).style.color = "black";
});
Unfortunately, the following CSS code is not achieving the desired effect:
.titles:hover {
border: 1px solid black;
background-color: #a0e1fa;
}