I have css and html codes as below.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
ul {
list-style-type: none;
}
.container {
width: 1000px;
margin: 0 auto;
}
.top-content {
width: 100%;
height: 100px;
background-color: gray;
}
nav ul {
display: flex;
justify-content: space-around;
}
nav ul li:hover {
cursor: pointer;
color: red;
}
main {
width: 100%;
height: 500px;
background: green;
}
nav ul li:hover .top-content {
background: red;
}
nav ul li:hover main {
background: red;
}
<div class="container">
<div class="top-content"></div>
<nav>
<ul>
<li>Lorem</li>
<li>Lorem</li>
<li>Lorem</li>
<li>Lorem</li>
<li>Lorem</li>
</ul>
</nav>
<main></main>
</div>
What I want is for the .top-content class and main element to be colored red when I hover over the li elements. But as far as I understand, I'm having a problem with the selectors. How can I change the color of these elements using css only?