Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8940075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:57:30+00:00 2026-06-15T10:57:30+00:00

I am writing a menu navigation using basic HTML ul/li lists, basic CSS code,

  • 0

I am writing a menu navigation using basic HTML ul/li lists, basic CSS code, and basic jQuery code. I have multiple levels of the menu, and the problem is that once the first level is displayed it automatically displays all the levels below it. Check out the Link to see if in action. The SheetMusic & Media menus are the ones in question.

I need help getting all of those submenu items not to display on default? Do any of you know how I could do that?

I hope one of you has an answer.

Morgan Kenyon

Here’s my relevant code working in a jsFiddle.

HTML

<div id="container">
<ul id="dropdown">
    <li class="mainnav"><a href="#">About</a></li>
    <li class="mainnav"><a href="#">Sheet Music</a>
        <img class="droparrow" src="@ACCOUNTRESOURCES/DropdownTriangle75.png"/>
        <ul>
            <li><a href="#">Solos</a>
                <img class="dropRarrow" src="@ACCOUNTRESOURCES/DropdownRTriangle75.png">
                <ul>
                    <li><a href="#">Solo 1</a></li>
                    <li><a href="#">Solo 2</a></li>
                </ul>
            </li>
            <li><a href="#">Exercises</a>
                <img class="dropRarrow" src="@ACCOUNTRESOURCES/DropdownRTriangle75.png">
                <ul>
                    <li><a href="#">Snare Drum</a></li>
                    <li><a href="#">Tenors</a></li>
                    <li><a href="#">Bass Drum</a></li>
                    <li><a href="#">Various Corps.</a></li>
                    <li><a href="#">Drum Set</a></li>
                </ul>
            </li>
            <li><a href="#">Rudiments</a></li>
        </ul>
    </li>
    <li class="mainnav"><a href="#">Gallery</a></li>
    <li class="mainnav"><a href="#">Media</a>
        <img class="droparrow" src="@ACCOUNTRESOURCES/DropdownTriangle75.png">
        <ul>
            <li><a href="#">Video</a>
                <img class="dropRarrow" src="@ACCOUNTRESOURCES/DropdownRTriangle75.png">
                <ul>
                    <li><a href="#">Solos</a>
                        <img class="dropRarrow" src="@ACCOUNTRESOURCES/DropdownRTriangle75.png">
                        <ul>
                            <li><a href="#">Snare</a></li>
                            <li><a href="#">Tenor</a></li>
                        </ul>
                    </li>
                    <li><a href="#">Ensembles</a></li>
                    <li><a href="#">Rudiments</a></li>
                    <li><a href="#">Miscellaneous</a></li>
                </ul>
            </li>
            <li><a href="#">Audio</a></li>
        </ul>
    </li>
</ul>

CSS

    #dropdown  {
        margin:0px 0px 0px 34px; 
        padding:0; 
        list-style:none;
    }
    #dropdown  li {
        float:left;         /* Show list items inline */
        margin: 3px 3px 1px 3px;
        /*padding: 7px 5px 14px 5px;*/
        position:relative; 
        font-size:100%;
    }
    #dropdown  li a {
        display:block;      /* Making sure a element covers whole li area */
        text-decoration:none; /* No underline */
        color:#FFFFFF;
        font-family: Calibri;
        font-size: 16px;
        font-weight: bold;
        padding:1px 7px 1px 7px;
        margin: 26px 0px 0px 7px;
    }
    #dropdown  li a:hover {
        background:rgba(255,255,255,.75);
        color:#000000;
        cursor:pointer;
        text-decoration:none;
        /*margin: 0px 0px 7px 7px;*/
        border-radius:2px;
        -moz-border-radius:25px; /* Firefox 3.6 and earlier */
    }
    /*Second Level */
    #dropdown  ul {
        position:absolute; 
        left:0; 
        display:none;
        margin:-3px 0px 0px 7px; 
        padding:0px 0px 0px 0px; 
        list-style:none;
        background: rgba(255, 255, 255, 0.75);
        border-radius:3px;
        z-index:4;
    }
    #dropdown ul:hover {
        position:absolute; 
        left:0; 
        margin:-3px 0px 0px 7px; 
        padding:0px 0px 0px 0px; 
        list-style:none;
    }
    #dropdown  ul li {
        float:left;
        width:108px;
        height:20px;    
        padding: 0px 0px 0px 0px;
        border-top:none;
    }
    #dropdown  ul li a {
        display:block;      /* Making sure a element covers whole li area */
        width:100px;
        padding: 2px 10px 2px 5px;
        margin: 0px 0px 0px 0px;
        color:#000000;
        text-decoration:none;   
    }

    #dropdown  ul li a:hover {
        padding: 2px 0px 2px 5px;
        margin: 0px 0px 0px 0px;
        color: rgba(255,255,255,1);
        background: rgba(0,0,0,.75);
    }
    /*Third Level    */
    #dropdown ul ul {
        position:absolute;
        display:none;
        left:0;
        padding:0px 0px 0px 0px;
        margin:-22px 0px 0px 118px;
    }
    #dropdown ul ul:hover {
        padding:0px 0px 0px 0px;
        margin:-22px 0px 0px 118px;
    }
    .droparrow {
        margin: 10px 0px 0px 30px;
        display:none;
    }
    .dropRarrow {
        position:absolute;  
        display:none;
        margin: -23px 0px 0px 111px;
    }

jQuery

$(document).ready(function () {    
        $('#dropdown li').hover(
            function () {
                $('ul, img', this).show();
            }, 
            function () {
                $('ul, img', this).hide();
            }
        );
    });​
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:57:31+00:00Added an answer on June 15, 2026 at 10:57 am

    In your hover function, you show all the ul and img-elements inside. Use the direct child selector to fix that:

    $(' > ul, > img', this).show();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a css code for a webpage, i have a navigation menu
I have begun writing a CSS and HTML collapsing menu system (AKA an accordion).
Im writing html and css in an old web application that is using the
I am writing the html code for navigation using the ul, li element, my
Writing documentation in html requires some code examples. What to do with characters that
Im writing an app that has a navigation controller as it's main menu system
I am writing some css code for a school website that looks like this
I'm working on writing a drop-down menu with jQuery and I have a question.
Okay, so I'm writing CSS for a navigation bar that uses an un-ordered list
I am writing a Ruby script that will generate a large flat HTML menu

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.