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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:20:53+00:00 2026-05-15T01:20:53+00:00

I am working on a horizontal CSS dropdown menu. It is still working nearly

  • 0

I am working on a horizontal CSS dropdown menu. It is still working nearly fine for IE 7, IE 8 , Firefox and Chrome. But I want to make the top <ul> to be on top level (e.g. z-index: 100). I want this because the top level <ul> has a graphical background and the dropdown is just styled with css and in the current way it is destroying the layout.

HTML Code:

<div id="mainMenu"> 
    <ul> 
        <li><a href="t1">TOP1<!--[if gt IE 6]><!--></a><!--<![endif]-->
        <!--[if lte IE 6]><table><tr><td><![endif]--> 
            <ul> 
                <li><a href="l1">LINK1</a></li> 
                <li><a href="l2">LINK2</a></li> 
                <li><a href="l3">LINK3</a></li> 
                <li><a href="l4">LINK4</a></li> 
            </ul>
        <!--[if lte IE 6]></td></tr></table></a><![endif]--> 
        </li>
        <li class="center"><a href="t2">TOP2<!--[if gt IE 6]><!--></a><!--<![endif]-->
        <!--[if lte IE 6]><table><tr><td></td></tr></table></a><![endif]--></li>
        <li><a name="t3">TOP3<!--[if gt IE 6]><!--></a><!--<![endif]--> 
        <!--[if lte IE 6]><table><tr><td><![endif]--> 
            <ul class="last"> 
                <li><a href="l5">LINK5</a></li> 
                <li><a href="l6">LINK6</a></li>
                <li><a href="l7">LINK7</a></li>
            </ul> 
        <!--[if lte IE 6]></td></tr></table></a><![endif]--> 
        </li> 
    </ul>
</div>

CSS Code

/* style the outer div to give it width */
#mainMenu {
    position: absolute;
    margin-left: 6px;
    margin-top: 180px;
}

/* remove all the bullets, borders and padding from the default list styling */
#mainMenu ul {
    position: absolute;
    width: 494px; 
    padding: 0;
    margin: 0;
    list-style-type: none;
    background: #FFF url(../images/mainMenu_bg.gif) no-repeat;
}

/* float the list to make it horizontal and a relative positon so that you can control the dropdown menu positon */
#mainMenu li {
    position: relative;
    float: left;
    padding-left: 5px;
    width: 160px;
    vertical-align: middle;
    text-align: left;
}

#mainMenu li.center {
    padding-left: 0px;
    text-align: center;
}

/* style the links for the top level */
#mainMenu a, #mainMenu a:visited {
    display: block;
    font: bold 12px/1em Helvetica, arial, sans-serif;
    color: #FFF;
    text-decoration: none;
    height: 42px;
    line-height: 35px;
}

/* hide the sub levels and give them a positon absolute so that they take up no room */
#mainMenu ul ul {
    visibility: hidden;
    position: absolute;
    height: 0;
    top: 35px;
    left: -5px;
    width: 165px;
}

/* style the table so that it takes no part in the layout - required for IE to work */
#mainMenu table {
    position: absolute; 
    top: 0;
    left: 0;
}

/* style the second level links */
#mainMenu ul ul a, #mainMenu ul ul a:visited {
    width: 165px;
    height: 20px;
    line-height: 19px;
    font: bold 10px Helvetica, arial, sans-serif;
    background: #EF7D0E;
    color: #FFF;
    text-align: left;
    padding: 6px 0 0 5px;
    border-top: 1px solid #C1650B;
}

#mainMenu ul ul.last a, #mainMenu ul ul.last a:visited {
    width: 162px;
}

/* style the top level hover */
#mainMenu a:hover, #mainMenu ul ul a:hover{
    color: #FFF; 
    text-decoration: underline;
}

#mainMenu :hover > a, #mainMenu ul ul :hover > a {
    color: #FFF;
    text-decoration: underline;
}

/* make the second level visible when hover on first level list OR link */
#mainMenu ul li:hover ul,
#mainMenu ul a:hover ul{
    visibility: visible; 
}

I have still a problem with showing the table in IE 6 but my main problem here is to show the LINK1…6 under the TOP links.

I have tried many settings with z-index but nothing worked here.
I hope you can help me 😉

  • 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-15T01:20:54+00:00Added an answer on May 15, 2026 at 1:20 am

    Try this:

    div#mainMenu ul
    {
      position:relative;
      z-index:100;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 400k
  • Answers 400k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Programming languages like C#, java, VB.Net etc change every year… May 15, 2026 at 4:07 am
  • Editorial Team
    Editorial Team added an answer pass the button to the ValidateOnDelete() function using OnClientclick="return ValidateOnDelete(this);"… May 15, 2026 at 4:07 am
  • Editorial Team
    Editorial Team added an answer I got it working by assigning a null value to… May 15, 2026 at 4:07 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.