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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:41:52+00:00 2026-06-16T19:41:52+00:00

I have a horizontal menu that is built with an unordered list. On mouseover

  • 0

I have a horizontal menu that is built with an unordered list. On mouseover of one of the list items a submenu will show that is contained within a div. In the submenu while the content displays correctly the div itself is constrained to the width of the parent list item. This results in content overflowing to the right of the div. How can I make it so that div expands with it’s content.

HTML & CSS on JSFiddle

HTML:

<div>
<ul class="menu">
  <li class="menuTab menuTabFirst">
    Menu Bar Item 1
    <div class="menuDropDown">
      <h2><a href="#">Menu Heading Goes Here</a></h2>
      <ul>
        <li><a href="#">Menu Item 1 Goes Here</a></li>
        <li><a href="#">Menu Item 2 Goes Here</a></li>
        <li><a href="#">Menu Item 3 Goes Here</a></li>
        <li><a href="#">Menu Item 4 Goes Here</a></li>
      </ul>

      <h2><a href="#">Menu Heading Goes Here</a></h2>
      <ul>
        <li><a href="#">Menu Item 1 Goes Here</a></li>
        <li><a href="#">Menu Item 2 Goes Here</a></li>
        <li><a href="#">Menu Item 3 Goes Here</a></li>
        <li><a href="#">Menu Item 4 Goes Here</a></li>
      </ul>
    </div>
  </li>

  <li class="menuTab">
    Menu Bar Item 2
    <div class="menuDropDown">
      <h2><a href="#">Menu Heading Goes Here</a></h2>
      <ul>
        <li><a href="#">Menu Item 1 Goes Here</a></li>
        <li><a href="#">Menu Item 2 Goes Here</a></li>
        <li><a href="#">Menu Item 3 Goes Here</a></li>
        <li><a href="#">Menu Item 4 Goes Here</a></li>
      </ul>
    </div>
  </li>
</ul>
</div>

CSS:

.menu {
    list-style-type: none;
    border-spacing:3px 0px;
    padding: 0px;
    display: table;
    margin: 5px 0px 0px;
    text-align:center;
    height: 26px;
    width: 300px;
}
.menuTab {
    background-color: #D2DCE0;
    display: table-cell;
    position: relative;
    margin:0px 5px 0px 0px;
    padding:6px 0px;
    font-size: 15px;
    width: auto;
    cursor: default;
    border-bottom: 0px;
    color: #002F68;
}
.menuTab:hover {
    background-color:#93B4D6;
    color: white;
}
.menuTab:hover .menuDropDown {
    left:0px; /* Shows the dropdown div */
}
.menuDropDown {
    background-color:#EBECEF;
    border:1px solid #6798CF;
    position: absolute;
    left:-999em; /* Hides the dropdown until menuTab mouseover */
    margin-top: 5px;
    z-index: 1;
    display: block;
}
.menuDropDown ul {
    list-style-type: none;
    margin:0px;
    padding:0px;
    margin-left: 20px;
    margin-bottom: 20px;
    text-align: left;
}
.menuDropDown h2 {
    font-size:14px;
    margin-left: 18px;
    margin-bottom: 5px;
    font-weight: normal;
    text-align: left;
}
.menuDropDown h2 a {
    color: black;
}
.menuDropDown li {
    font-size:14px;
    padding:0px;
    margin-left: 10px;
}
.menuDropDown li a {

}    
.menuDropDown li:hover {
        background-color: #EBECEF;
}
.menuLastTab {
    margin-right: 0px;
}​
  • 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-16T19:41:54+00:00Added an answer on June 16, 2026 at 7:41 pm

    Try this to position submenus properly:

    .menuTab:hover .menuDropDown {
        left: inherit; /* Shows the dropdown div positioned properly */
    }
    

    And this to enable scaling the content inside menu:

    .menuDropDown ul {
        list-style-type: none;
        margin:0px;
        text-align: left;
        padding: 20px;
    }
    

    Regards.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a horizontal menu that has been created using an unordered list. The
i have a that contains a HORIZONTAL menu. the menu consists of an unordered
I have a ul list that I display as a horizontal menu. I'd like
I currently have a drop-line horizontal menu using an unordered list with the following
I have a horizontal nav menu that I am working on. I have one
New to jquery. The desire is to show/hide horizontal menu bar items. I have
I have an unordered inline horizontal list menu, when my mobile media query kicks
I am making one simple horizontal menu with CSS and simple unordered list. The
I have a simple ul horizontal menu that exists within a div that is
I'm trying to make a flexible, horizontal menu that will always have a total

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.