0

I've got a menu that looks something like this

   <nav role="navigation" class="small--hide">
    <ul class="site-nav">
        <li class="has-desktop-dropdown collection-dropdown">Link 1</li>
        <li>Link 2</li>
         <li class="has-desktop-dropdown journal-dropdown">Link 3</li>
    </ul>
   </nav>

Now I want a div to show when one of the list items is hovered

<div class="desktop-dropdown collection-dropdown-menu small--hide">
 <p>Some content</p>
</div>
<div class="desktop-dropdown journal-dropdown-menu small--hide">
 <p>Some content</p>
</div>

The Css I've been trying to use is this:

  .collection-dropdown:hover  ~ .collection-dropdown-menu {
    display:block;
  }
  .journal-dropdown:hover ~ .journal-dropdown-menu {
    display:block;
  }

But it's not showing the div on hover. Any ideas what I'm doing wrong?

Fiddle

MariaL
  • 820
  • 1
  • 12
  • 29
  • 1
    You've shown two separate elements without showing where they are in the document in relation to each other. How did you expect us to help? – David says reinstate Monica Aug 01 '18 at 11:13
  • I believe for tilde operator to work the later has to be the sibling of the former. That doesn't seem to be the case with you. – Saurabh Tiwari Aug 01 '18 at 11:13
  • Here is working fiddle:https://jsfiddle.net/ckLf0gxt/12/ – לבני מלכה Aug 01 '18 at 11:25