title: How can I change the color of the places I want when the li element hover?
body: <p>I have css and html codes as below.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>* {
    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;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="container"&gt;
    &lt;div class="top-content"&gt;&lt;/div&gt;
  
    &lt;nav&gt;
      &lt;ul&gt;
        &lt;li&gt;Lorem&lt;/li&gt;
        &lt;li&gt;Lorem&lt;/li&gt;
        &lt;li&gt;Lorem&lt;/li&gt;
        &lt;li&gt;Lorem&lt;/li&gt;
        &lt;li&gt;Lorem&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/nav&gt;
  
    &lt;main&gt;&lt;/main&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>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?</p>