search

Home  >  Q&A  >  body text

Mouseover of specific menu item not showing hidden submenu

I created some classes for the menu items so that I can call them.

.dropdownBox {
        display: none;
      }

      .dropdown li:hover > ul.dropdownBox {
        display: block;
      }

However, the scroll state that "works" with the .dropdown class now displays submenu items with the .dropdownBox class

<nav class="screen2_menu_container">
      <label for="screen2_menu_check" class="screen2_menu_btn">
        <!-- checkbox to track when the hamburger menu is clicked on -->
        <input type="checkbox" id="screen2_menu_check" class="screen2_input" />

        <!-- the hamburger menu -->
        <div class="screen2_menu_hamburger"></div>

        <!-- menu items -->
        <ul class="screen2_menu_items navPositionRight" id="screen2_menu_items">
          <a href="CONTACT-US" rel="history"><span>> CONTACT</span></a>
        </ul>
        <ul
          id="screen2_menu_items_Nav"
          class="screen2_menu_items navPositionLeft"
        >
          <li>
            <a href="HOME" rel="history"><span>> HOME</span></a>
          </li>
          <li class="dropdown">
            <a href="WORK"><span>> WORK</span></a>
          </li>
          <ul class="dropdownBox">
            <li>
              <a href="WORK-1"><span>WORK-1</span></a>
            </li>
            <li>
              <a href="WORK-2"><span>WORK-2</span></a>
            </li>
            <li>
              <a href="WORK-3"><span>WORK-3</span></a>
            </li>
            </ul>
          <li>
            <a href="REEL"><span>> REEL</span></a>
          </li>
          <li class="hideDiv">
            <a href="CONTACT-US" rel="history"><span>> CONTACT</span></a>
          </li>
        </ul>
      </label>
    </nav>

I'm trying to use the .dropdown class so it displays the .dropdownBox class when you hover over it, but I can't seem to get the correct selector to work.

P粉138871485P粉138871485236 days ago466

reply all(1)I'll reply

  • P粉281089485

    P粉2810894852024-04-05 00:38:54

    Just update your CSS. Hope this is useful to you.

      .dropdownBox {
            display: none;
          }
    
          .dropdown:hover + .dropdownBox  {
            display: block;
            
          }
    
    .dropdownBox:hover {
      display: block;
    }
        

    reply
    0
  • Cancelreply