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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:01:35+00:00 2026-05-31T03:01:35+00:00

I’m creating a CSS drop down menu which is going well so far, however

  • 0

I’m creating a CSS drop down menu which is going well so far, however I have a problem with the width the <li> or <a> in the sub menu.

http://jsfiddle.net/8Cbe8/

If you hover over ‘About Us’ you’ll all of the sub menu links are different widths. I’ve tried setting both elements to width: 100% but I’m guessing the problem is something to do with the <ul> being absolutely positioned and not having a fixed width.

Could you please point me in the right direction to fix this.

NOTE: This probably won’t work in earlier versions of IE yet, that’s something I’m going to be working on next

  • 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-31T03:01:36+00:00Added an answer on May 31, 2026 at 3:01 am

    See this updated jsFiddle

    Set the width of it to be auto. I have also included a z-index so it renders above the other elements

    HTML

        <ul>
            <li><a href="#">Home</a></li>
            <li><a href="#">About Us</a>
                <ul>
                    <li><a href="#">History</a></li>
                    <li><a href="#">The Team</a></li>
                    <li><a href="#">In The News</a></li>
                </ul></li>
            <li><a href="#">Our Work</a></li>
            <li><a href="#">Blog</a></li>
            <li><a href="#">Partners</a></li>
            <li><a href="#">Resellers</a></li>
            <li><a href="#">Our Contact</a></li>
        </ul>
    
    </div>​
    

    CSS

     body{font: 13px verdana; margin: 10px}
    
    #main-nav ul, #main-nav ul li ul {list-style: none; margin: 0; padding:0;}
    
    #main-nav ul li{
        display: block;
        float: left;
        position: relative;
    }
    
    #main-nav ul li a{
        display: block;
        height: 35px;
        line-height: 35px;
        background: lightblue;
        padding: 0 10px;
        color: black;
        text-decoration: none;
    }
    
    #main-nav ul li a:hover{background: #EEE}
    
    #main-nav ul li:hover ul{left: 0px;}
    
    /* This is the bit I'm having a problem with  */
    
    #main-nav ul li ul{
        position: absolute;
        left: -9999px;
        top:35px;
        background: lightblue;
    }
    
    #main-nav ul li ul li {white-space: nowrap; width: 100%; z-index: 999}
     ​    ​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into

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.