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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:55:02+00:00 2026-05-28T01:55:02+00:00

I have a drop down menu created purely with CSS. I would like to

  • 0

I have a drop down menu created purely with CSS. I would like to implement an overflow using z-index (i presume) that will bleed over a border on my menu to give the impression that both the link and the dropdown menu are joined.

The drop down works correctly but I need the first menu item to overflow it’s white background on to the drop down menu.

If you go to http://cssdesk.com/ztK64 and hover over the first menu link you will see what I am attempting to explain.

This is my code:

CSS

    /*Main nav*/
.main_nav_container{
    margin: 10px 0 10px 0;
    float:right;
}
ul.main_nav{
    margin:0;
    z-index:1;
    postion:absolute;
}
ul.main_nav li{
    margin:0;
    display:inline-block;
    border-top:solid 1px transparent;
    border-left:solid 1px transparent;
    border-right:solid 1px transparent;
}
ul.main_nav li a{  
    font-size:13px;
    display:block;
    font-weight:bold;
    height:25px;
    line-height:25px;
    padding:0 13px;
    text-decoration:none;
    color:#1122cc;
    border:1px solid transparent;
}
ul.main_nav li a:hover{
  text-decoration:underline;
}
ul.main_nav li:hover{
    border-top:solid 1px #ccc;
    border-left:solid 1px #ccc;
    border-right:solid 1px #ccc;
    -moz-border-radius: 4px 4px 0 0;
    border-radius: 4px 4px 0 0;
    -webkit-border-radius:  4px 4px 0 0;
    -khtml-border-radius: 4px 4px 0 0;
    background: #fff;
} 
ul.main_nav li:hover ul{
    display:inline;
}
ul.main_nav li ul{
    display:none;
    z-index:500;
    position:absolute;
    background: #fff;
    margin:0;
    padding:0;
    border:solid 1px #ccc;
    -moz-border-radius: 0 4px 4px 4px;
    border-radius: 0 4px 4px 4px;
    -webkit-border-radius:  0 4px 4px 4px;
    -khtml-border-radius:  0 4px 4px 4px;
}
ul.main_nav li ul li{
    display:block;
    margin:0;
    padding:0;
    text-align:left;
}
ul.main_nav li ul li:hover{
    text-decoration:underline;
    border-top:solid 1px #fff;
    border-left:solid 1px #fff;
    border-right:solid 1px #fff;
}
ul.main_nav li ul li a{
    font-weight:normal;
}

HTML

<div class="main_nav_container">
                <ul class="main_nav">
                <li>
                <a id="hover" href="#">For sale</a>
                    <ul>
                        <li><a href="#">Property for sale</a></li>
                        <li><a href="#">New homes for sale</a></li>
                        <li><a href="#">Find estate agents</a></li>
                    </ul>
                </li>


                <li><a href="#">To rent</a></li>
                <li><a href="#">New homes</a></li>
                <li><a href="#">House prices</a></li>
                <li><a href="#">Blog</a></li>
                <li><a href="#">Property advice</a></li>
                <li><a href="#">Contact</a></li>
                </ul>
            </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-05-28T01:55:03+00:00Added an answer on May 28, 2026 at 1:55 am

    Add the following CSS:

    ul.main_nav li:hover a {
     border-bottom:1px solid white;
     position:relative;
     z-index:100;
    }
    ul.main_nav li:hover ul {
     margin-top:-1px;
     margin-left:-1px;
     z-index:99;
    }
    

    You have to have the position:relative; in the a to make the z-index work correctly. The bottom border of the a is to cover up the border of the ul. The margin changes in the ul are to position the borders correctly for the effect of them being connected.

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

Sidebar

Related Questions

I have created a drop-down-menu, the html for the drop-down part basically looks like
I created a drop down nav menu purely in css and everything works correctly
We have a drop-down menu of volumes in our UI, and I'd like to
So, I have an animated drop down menu that slides down when your mouse
I would like to display all my category names in a drop down menu
I would like to create a drop down menu on top of my google
I have created a drop down menu with animals. But what I wanna do
I have created a simple drop down menu, with functions in it. And then
So, basically I have this select / drop down menu that I use AJAX
I have a drop down menu that I am dynamically populating based on values

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.