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 6323575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:32:41+00:00 2026-05-24T16:32:41+00:00

I have been building a CSS drop down menu and I have a slight

  • 0

I have been building a CSS drop down menu and I have a slight snag and wondered if anyone could help me fix this. I have a menu that has this HTML

<div id="menu">
<ul>
<li><a class="active" href="#">Home</a>
<ul class="sub-menu">
<li><a href="#">This is sub</a></li>
<li><a href="#">sub menu item</a></li>
<li><a href="#">This is a long sub menu item</a></li>
</ul>
</li>  
<li><a href="#">Location</a></li>
<li><a href="#">another link</a></li>
</ul>
</div>

Currently when I hover over the main <li> ‘Home’ it’s width expands a lot, I think to accommodate the sub-class menus that I have. How can I stop this from occurring? To achieve something like:

|Home| // Nice short main tab
|A sub menu link |
|Another sub menu link|

As opposed to this that is currently happening (forgive the crudeness of my diagram)

|Home………………..| // really long messing up everything tab
|A sub menu link |
|Another sub menu link|

This is my CSS code for the menu:

#menu ul {
margin: 0;
list-style: none;
padding: 0 0 0 20px;
position: relative;
z-index: 40;
}
#menu ul li {
float: left;
padding: 10px 10px 13px 0;
position: relative;
z-index: 50;
}
#menu li a {
text-decoration: none;
font-family: Verdana, Geneva, sans-serif;
  • 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-24T16:32:41+00:00Added an answer on May 24, 2026 at 4:32 pm

    I have basically the same markup so the following code should work well for what you need.

    I left all of the color and image info in case you needed help there too.

    #menu {
        background: none repeat scroll 0 0 #333333;
        border: 0 none;
        font: bold 14px "Lucida Sans Unicode","Bitstream Vera Sans","Trebuchet Unicode MS","Lucida Grande",Verdana,Helvetica,sans-serif;
        margin: 0;
        padding: 0;
        width: 100%;
    }
    #menu ul {
        background: none repeat scroll 0 0 #333333;
        height: 35px;
        list-style: none outside none;
        margin: 0 0 3px;
        padding: 0;
        width: 100%;
    }
    #menu li {
        float: left;
        padding: 0;
    }
    #menu li a {
        background: no-repeat scroll right bottom #333333;
        color: #CCCCCC;
        display: block;
        font-weight: normal;
        line-height: 35px;
        margin: 0;
        padding: 0 10px;
        text-align: center;
        text-decoration: none;
    }
    #menu li a:hover, #menu ul li:hover a {
        background: no-repeat scroll center bottom #2580A2;
        color: #FFFFFF;
        text-decoration: none;
    }
    #menu li ul {
        background: none repeat scroll 0 0 #333333;
        border: 0 none;
        display: none;
        height: auto;
        margin: 0;
        padding: 0;
        position: absolute;
        width: 225px;
        z-index: 200;
    }
    #menu li:hover ul {
        display: block;
    }
    #menu li li {
        display: block;
        float: none;
        margin: 0;
        padding: 0;
        width: 225px;
    }
    #menu li:hover li a {
        background: none repeat scroll 0 0 transparent;
    }
    #menu li ul a {
        display: block;
        font-size: 12px;
        font-style: normal;
        height: 35px;
        margin: 0;
        padding: 0 10px 0 15px;
        text-align: left;
    }
    #menu li ul a:hover, #menu li ul li:hover a {
        background: no-repeat scroll left center #2580A2;
        border: 0 none;
        color: #FFFFFF;
        text-decoration: none;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been building enterprise software for the last 10 years. In this time
I have been building this app for a while now and have not had
I have been building IMO a really cool RIA. But its now close to
I have been building a new application using my current understanding of domain driven
I have been building a game for a while (nearly done) - But the
I want to bounce an idea around. I have been building web services and
I have been investigating building web parts for sharepoint 2010 and currently have a
I have been involved in building a custum QGIS application in which live data
I have been using PHP and JavaScript for building my dad's website. He wants
I am building a web application and have been told that using object oriented

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.