Solution 1 :

Since CSS can only interact with things inside or below the current element, the easiest solution would be to use Javascript to handle the hover for you.
You can use the function addEventListener to add both a mouseover and a mouseout event on your restaurant text to add/remove a hover class to whichever element you want to hover.

var nav = document.querySelector('nav');
var headingRestaurant = document.querySelector('.headingRestaurant');

headingRestaurant.addEventListener('mouseover', function() {
    nav.classList.add('hover');
});

headingRestaurant.addEventListener('mouseout', function() {
    nav.classList.remove('hover');
});
.headingRestaurant:hover {
    color: red;
}

.headingRestaurant {
    cursor: pointer;
}

.textb {
    pointer-events: none;
}

.headingRestaurant {
    pointer-events: initial;
}

.textb:hover {
    color: white;
}

nav.hover,
nav.hover a {
    color: red;
}
<nav>
    <ul>
        <li>
            <a
            href="file:///C:/Users/.../index.html"
                        >Home</a
                        >
        </li>
        <li>
            <a
            href="file:///C:/Users/.../about.html"
                        >About</a
                        >
        </li>
    </ul>
</nav>

<h1 class="textb">
    Not a <span id="heading1" class="headingRestaurant">restaurant</span>,
    <br />
    but here for them.
</h1>

If you’d like to use html and css only, you’d have to reverse the html flow so that the element you want to change is coded below the element you’re hovering over.

In this case I’ve moved the nav and h1 to a container div and swapped them around so that the h1 is coded above the nav. The display order is then fixed by using both the properties display: flex and flex-direction: column-reverse. The hover in this method uses the css selector ~ which matches an selector that is preceded by another selector. In the case of .textb:hover ~ nav it would select any nav element that is preceded by a .textb which is hovered over. Since the part after the ~ is still a selector, you could also change a specific menu item.

.headingRestaurant {
    cursor: pointer;
    pointer-events: initial;
}

.textb {
    pointer-events: none;
}

.textb:hover {
    color: white;
}

.textb:hover .headingRestaurant {
    color: red;
}

.textb:hover ~ nav,
.textb:hover ~ nav a {
    color: red;
}

.textb:hover ~ nav a.about {
    color: purple;
}

.reversed {
    display: flex;
    flex-direction: column-reverse;
}
<div class="reversed">
  <h1 class="textb">
      Not a <span id="heading1" class="headingRestaurant">restaurant</span>,
      <br />
      but here for them.
  </h1>

  <nav>
      <ul>
          <li>
              <a class="about" href="file:///C:/Users/.../index.html">Home</a>
          </li>
          <li>
              <a href="file:///C:/Users/.../about.html">About</a>
          </li>
      </ul>
  </nav>

</div>

Solution 2 :

:has is definitely the way to go here but there are some clever cookies out there who might come up with something innovative. Note that this isn’t fully supported yet.

/* This is just making things pretty */

nav ul li {
  display: inline-block;
  padding: 0.5rem 1rem;
  margin: 0;
  border: 1px dotted red;
}

nav ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

nav ul li a {
  text-decoration: none;
  color: inherit;
}


/* This is the functional stuff */

.headingRestaurant:hover {
  color: red;
}

.headingRestaurant {
  cursor: pointer;
}

.textb {
  pointer-events: none;
}

.headingRestaurant {
  pointer-events: initial;
}

.textb:hover {
  color: white;
}


/* This colours the menu on hover */

body:has(.headingRestaurant:hover) nav {
  background-color: lightblue;
}
<nav>
  <ul>
    <li>
      <a href="file:///C:/Users/.../index.html">Home</a>
    </li>
    <li>
      <a href="file:///C:/Users/.../about.html">About</a>
    </li>
  </ul>
</nav>

<h1 class="textb">
  Not a <span id="heading1" class="headingRestaurant">restaurant</span>,
  <br> but here for them.
</h1>

Solution 3 :

Replace target with whatever class/id you are using to identify your menu element and it will control the styling when hovering on the .headingRestaurant element.

.headingRestaurant:hover target {

}

Problem :

I want to change the color of the menu on text hover. But not when the menu text is hovered but another heading. I have a heading “Not a restaurant, but here for them.” and when the user hovers the word “restaurant” the menu text color should change to white and the word “restaurant” to red and the rest of the heading to white. The second part (that “restaurant” changes to red and the rest of the heading to white) already works. But how can I make it that also the color of the menu changes?

.headingRestaurant:hover {
  color: red;
}

.headingRestaurant {
  cursor: pointer;
}

.textb {
  pointer-events: none;
}

.headingRestaurant {
  pointer-events: initial;
}

.textb:hover {
  color: white;
}
<nav>
  <ul>
    <li>
      <a href="file:///C:/Users/.../index.html">Home</a>
    </li>
    <li>
      <a href="file:///C:/Users/.../about.html">About</a>
    </li>
  </ul>
</nav>

<h1 class="textb">
  Not a <span id="heading1" class="headingRestaurant">restaurant</span>,
  <br> but here for them.
</h1>

Comments

Comment posted by Adam

Do you want the tags to change colour on hover?

Comment posted by Thor Solutions

thanks for your response! It works fine, but I also have a footer (also with an unordered list) where I want to change the color and this doesn´t work. I think because of the querySelector, but I don´t know exactly. Any solutions?

Comment posted by Thomas

The querySelector in javascript uses the same style selectors as css does, but matches only one element. So the

Comment posted by Thomas

That’s actually pretty damn clever. You might want to add that it’s currently only supported by webkit flavored browsers though.

Comment posted by Adam

Added a comment with a link to caniuse.com. Good call.

Comment posted by Adam

That’ll only work for children elements of the headingRestaurant span which is not what, I believe, the poster is asking for.

By