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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:22:10+00:00 2026-06-13T03:22:10+00:00

I tried with various settings for display and position but I don’t know how

  • 0

I tried with various settings for display and position but I don’t know how to arrange the subitems in my future dropdown menu. They overlap with the other menuitems and don’t stay in place where they should. Unfortunately even this question + answer couldn’t help me.

This is my CSS code:

#menu ul li a {
text-decoration: none;
background-color: #FF0000;
font-size: 16px;
margin: 10px 5px 10px 5px;
display: block;
float: left;
position:relative; }

#menu ul li a:hover {
background-color: #0000FF; }

#menu ul li ul li a {
clear: left;
background-color: #6F0;
font-size: 10px;
display: block;
position: absolute; }

I tried combined selectors like these

#menu ul li a + #menu ul li ul li a { }

li.page_item > li.page_item { }

but they did not work either.

Edit:
Here is some HTML/PHP code. It’s a wordpress template, now I think I should have mentioned that before …

            <div id="menu" role="navigation">
            <?php /* Navigation menu. */ ?>
            <?php wp_nav_menu(array('sort_column' => 'menu_order', 'menu' => 'Categories', 'container_class' => 'main-menu-class',
                                    'container_id' => 'main-menu-id', 'theme_location'  => 'header', 'show_home' => true)); ?>
        </div> <!-- menu -->

And the rendered HTML code is:

<div id="menu" role="navigation">
<div class="menu">
<ul>
<li class="current_page_item">
<a title="Home" href="http://mywebsite.com/wordpress/">Home</a>
</li>
<li class="page_item page-item-40">
<a href="http://mywebsite.com/wordpress/?page_id=40">Cupcake Ipsum</a>
<ul class="children">
<li class="page_item page-item-388">
<a href="http://mywebsite.com/wordpress/?page_id=388">Red Velvet Cupcake</a>
</li>
<li class="page_item page-item-390">
<a href="http://mywebsite.com/wordpress/?page_id=390">Mango Cupcake</a>
</li>
<li class="page_item page-item-392">
<a href="http://mywebsite.com/wordpress/?page_id=392">Chocolate Cupcake</a>
</li>
</ul>
</li>
<li class="page_item page-item-43">
<a href="http://mywebsite.com/wordpress/?page_id=43">Bacon Ipsum</a>
<ul class="children">
<li class="page_item page-item-405">
<a href="http://mywebsite.com/wordpress/?page_id=405">Bacon Pancakes</a>
</li>
</ul>
</li>
<li class="page_item page-item-45">
<a href="http://mywebsite.com/wordpress/?page_id=45">Veggie Ipsum</a>
<ul class="children">
<li class="page_item page-item-397">
<a href="http://mywebsite.com/wordpress/?page_id=397">Tomato</a>
</li>
<li class="page_item page-item-399">
<a href="http://mywebsite.com/wordpress/?page_id=399">Lettuce</a>
</li>
<li class="page_item page-item-401">
<a href="http://mywebsite.com/wordpress/?page_id=401">Broccoli</a>
</li>
<li class="page_item page-item-403">
<a href="http://mywebsite.com/wordpress/?page_id=403">Onion</a>
</li>
</ul>
</li>
</ul> 
</div>
</div>
  • 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-13T03:22:12+00:00Added an answer on June 13, 2026 at 3:22 am

    I’ve made some changes to your CSS to fix the overlap issues.

    #menu ul li a {
      float: none; /* no need for float */
    }
    
    #menu ul li ul li a {
     position: static; /* no need for absolute positioning here */
    }
    
    .menu ul li {
      display: inline-block;
      position: relative;
    }
    
    .menu li ul {
     position: absolute; 
    }
    
    .menu li:not(:hover) ul {
     display: none; 
    }
    

    And here’s a demo: http://jsbin.com/aloreh/1/edit

    Your general problem is that you’re putting position: absolute and position: relative on the wrong things. It’s good that you’re applying all your link styling to the actual link elements, but you need to apply the positioning to the lists and the list items.

    So, the first level list items need to have position: relative. This allows submenus to be positioned relative to the first level items. Then the submenu uls will have position: absolute so that they don’t reflow the page when they appear on hover.

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

Sidebar

Related Questions

I've tried various things and googled multiple hours but couldn't find a solution to
I have searched the documentation and tried various techniques but have't found a suitable
I'm trying to compile Python 2.6 for 64bit, I tried various compile commands but
string in question: '{images:{0:<div style=\\background:red;width:250px;height:250px;display:block;position:absolute;\\></div>}}' I've tried various combinations of single and double quotes.
I know this won't work. I tried it in various forms and failed all
Input: $string = this-is-just-an--example Output: this is just an-example Tried various things centered around
I need help with some CSS styling. I've tried various options with Firebug and
I have tried all of these various ways to set the value of the
I tried to look for benchmark on the performances of various filesystems with MySQL
I have various Debug.WriteLine messages, I tried to see those messages using export MONO_DEBUG_LEVEL=debug,

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.