I've already checked out the question and subsequent answer on how to hide a div with css, but I could not figure out how to make it work if the different elements aren't under the same parent. For example:
<head>
<style>
section .city {
display: none;
}
nav .london:hover ~ section .london {
display: block;
}
</style>
</head>
<body>
<nav>
<div class="city london">London</div>
</nav>
<section>
<div class="city london">
<p class="text">London text etc.</p>
</div>
</section>
</body>
Here, I'd like to only show the .text element when the appropriate div in the nav section is being hovered over. This works without the nav & section areas, as the divs become siblings, but how would I obtain the same behaviour while still using the nav and section tags?