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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:47:50+00:00 2026-05-28T03:47:50+00:00

I’m building a navigation with has a drop down unordered list within an unordered

  • 0

I’m building a navigation with has a drop down unordered list within an unordered list. I’d like to make the list items as wide as at least the “head” list item so that the drop down menu looks right. Just now the drop down menu is thinner as the line items have a lower character count than the line item that contains the unordered list.

I’d like to make somehting of the order:

ul li ul {
{width: *as wide as ul li*;
}

Is it possible to do this without javascript and just within css alone?

  • 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-28T03:47:51+00:00Added an answer on May 28, 2026 at 3:47 am

    Yes, it is. Technically, the ul is already the same width, but it doesn’t appear to be due to margins and padding. To change this, use this CSS:

    ul li ul {
     width:100%;
     margin-left:0;
     margin-right:0;
     padding-left:0;
     padding-right:0;
    }
    

    You may also want to include the following CSS to change the padding/margin of the li child as well:

    ul li ul > li {
     width:100%;
     margin-left:0;
     margin-right:0;
     padding-left:0;
     padding-right:0;
    }
    

    Update

    In your specific example (posted in comments), the issue is you’ve set ul li ul‘s position value to absolute. This takes it out of it’s parent (in regards to handling width), but can be fixed with the following CSS being added to your existing CSS:

    ul li {
     position:relative;
    }
    ul li ul {
     width:100%;
    }
    

    While this allows you to set the submenu to be the same width as the parent, it comes with the side effect of making the menu items wrap (see sui generis menu). To overcome this, use the following CSS instead (in addition to your jsFiddle):

    ul li {
     position:relative;
    }
    /* Due to 'min-width', this may not be compatible with all browsers */
    ul li ul {
     min-width:100%;
     white-space:nowrap;
    }
    
    • 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’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
We're building an app, our first using Rails 3, and we're having to build

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.