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

  • Home
  • SEARCH
  • 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 952761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:56:47+00:00 2026-05-15T23:56:47+00:00

I am trying to make CSS drop down menu (no javascript involved). According to

  • 0

I am trying to make CSS drop down menu (no javascript involved). According to
http://pixelspread.com/blog/289/css-drop-down-menu I only need to add

#menuBar #test2 a:hover .subMenu{display:block;}   

to make the sub menu show up. However, in my code, it doesn’t work. Could someone help me about this issue? Thanks a lot!

My html

<ul id="menuBar">
   <li id="test1">test1</li>
   <li id="test2"><a href="#">Pro1</a>
     <div class="subMenu">
        <ul>
           <li><a href="#">sub1</a></li>  
           <li><a href="#">sub2</a></li>
           <li><a href="#">sub3</a></li>
         </ul>
         <ul>
            <li><a href="#">Volleyball</a></li>
            <li><a href="#">Walking</a></li>
            <li><a href="#">Water Shoes</a></li>
         </ul>
       </div> <!--end of submenu-->
     </li>
  </ul>

My Css

 #menuBar #test2 a{
background:url("../images/btTest.jpg") no-repeat bottom;
display:block;
border-right:1px solid #ffffff;
width:112px;
height:37px;
}

#menuBar #test2 a:hover{
background:url("../images/btTest.jpg") no-repeat top;
}

#menuBar #test2 a:hover .subMenu{  
// I add .subMenu after a:hover and have two a:hover for #test2 a
// I know it won't work but not sure what to do now.
//thanks for the help.
display:block;
}


.subMenu{  // the hidden menu
position:absolute;
top:35px;
left:0px;
z-index: 99999;
width:550px;
background-color:black;
display:none;
}
  • 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-05-15T23:56:48+00:00Added an answer on May 15, 2026 at 11:56 pm

    Your HTML structure isn’t set up to allow multiple sub-menus with a single css statement. If you look at Mcinerney’s HTML:

    <div id="menu">
      <ul id="item1">
        <li class="top">menu item</li> 
        <li class="item"><a href="#">menu item 1</a></li> 
        <li class="item"><a href="#">menu item 2</a></li> 
        <li class="item"><a href="#">menu item 3</a></li> 
      </ul> 
    </div>
    

    and his css:

    #menu ul:hover .item{display:block;}
    

    it translates to “If you hover over a “ul” that is a descendant of an element with id, “menu”, then find all elements that are descendants of said “ul” with the class, “item” and set their display to “block”.

    You can do something similar, but you will need to add a line of css for each sub-menu based on the id of the LI element:

    #test2:hover div.subMenu { display: block; }
    

    “#test2” refers to any element with an id of “test2”.

    “div.subMenu” refers to any element (in this case a div) with a class designation of “subMenu”. Because it comes after “#test2”, the div element must be a descendant of “#test2”.

    In order to keep your background-image on hover, you’d need to make some changes to the css and html. First, designate a class on the “A” (because we don’t want to reference all “A” elements that are children of #test2, just the designated one):

    <li id="test2"><a href="#" class="top">Pro1</a> ...
    

    Then modify your css so that the background is set upon the hover over #test2 (not #test2 a):

    #test2:hover a.top {
      background:url("../images/btTest.jpg") no-repeat top;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://www.dynamicdrive.com/dynamicindex1/chrome/index.htm Hi, I'm trying to make a dropdown menu with only css. I don't
I am trying to make drop down menu. Some folks helped me on CSS
I'm trying to make a simple CSS drop down menu that when you mouse
I'm trying to make a CSS/javascript dropdown menu (based on this example . This
I am trying to make the drop down menu lists display inline(horizontally) but end
I am trying to make a SIMPLE Css percent bar. OK go to http://htmledit.squarefree.com/
I am trying to make a menu in javascript/JQuery (css is also an option)
I am trying to make a dropdown menu with pure html and css, but
Trying to make a floating css menu. How do I get the floating div
I have been trying to make custom radio buttons using HTML, CSS, and JavaScript.

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.