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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:26:04+00:00 2026-06-01T02:26:04+00:00

I’m making a CSS dropdown menu. So, when the mouse hovers one menu item,

  • 0

I’m making a CSS dropdown menu. So, when the mouse hovers one menu item, it displays its subitens. Well, all is working fine except the position of submenus. What I got is this:

|Menu 1|    |Menu 2|
            |Submenu 1|
            |Submenu 2|
            |Submenu 3|

But I have to change this layout into this, when the mouse hovers a item:

|Menu 1|    |Menu 2|
         |Submenu 1|
         |Submenu 2|
         |Submenu 3|

I don’t know if it’s even possible to make that change.

CSS

.menu{
border:none;
border:0px;
margin:0px;
padding:0px;
font: 67.5% "Lucida Sans Unicode", "Bitstream Vera Sans", "Trebuchet Unicode MS", "Lucida Grande", Verdana, Helvetica, sans-serif;
font-size:14px;
font-weight:bold;
    float: right;
    width: auto;
}

.menu ul{
background:#EBF0FD;
line-height: 2.0em;
list-style:none;
margin:0;
padding:0px;
}

.menu li{
    float:left;
    padding:0px;
    }

.menu li a{
    background:#EBF0FD url("images/seperator.gif") bottom right no-repeat;
    color:#336699;
    display:block;
    font-weight:normal;
    line-height:2.0em;
    margin:0px;
    padding:0px 25px;
    text-align:center;
    text-decoration:none;
    }

.menu li a:hover, .menu ul li:hover a{
        background: #5E78B5 bottom center no-repeat;
        color:white;
        text-decoration:none;
}

.menu li ul{
    background:#EBF0FD;
    display:block;
            float: left;
    height:auto;
    padding:0px;
    margin:0px;
    border-style:solid;
            border-color:#C9D8FF;
    position:absolute;
    width:auto;
    z-index:200;
    }

.menu li:hover ul{
    display:block;
    }

.menu li li {
    background: bottom left no-repeat;
    display:block;
    float:none;
    margin:0px;
    padding:0px;
    width:225px;
            color: red;
    }

.menu li:hover li a{
    background:none;
    color: #336699;
    }

.menu li ul a{
    display:block;
    line-height:35px;
    font-size:12px;
    font-style:normal;
    margin:0px;
    padding:0px 10px 0px 15px;
    text-align:left;
    }

.menu li ul a:hover, .menu li ul li:hover a{
        background:#5E78B5 left no-repeat;
        border:0px;
        color:#ffffff;
        text-decoration:none;
        }

.menu p{
    clear:left;
    }   

HTML

<div class="menu">
    <ul>
        <li>
              <a href="#">Menu 1</a>
               <ul>
                   <li><a href="#">Submenu 1</a></li>
                   <li><a href="#">Submenu 2</a></li>
                   <li><a href="#">Submenu 3</a></li>
                </ul>
         </li>
     </ul>                
 </div>

SOLUTION:

Andres Ilich’s code have solved my problem (Thanks!). Now, all submenus upper right edge is correctly aligned with the bottom right edge of the top menus. However, there was a problem when several menus itens (top level) were in the layout so that they appeared in vertical, not horizontal. I was able to correct it. So, I’m posting the final working CSS if anyone is also facing this problem. Thanks for helping!

.menu {
    font-size:14px;
    font-weight:bold;
    float: right;
    width: auto;
}

.menu ul {
    background:#EBF0FD;
    line-height: 2.0em;
    list-style:none;
    margin:0;
    padding:0px;
    font-family: Verdana, Geneva, sans-serif;
}

.menu  li {
    float:left;
    padding:0;
    margin:0;
    position:relative;
}

.menu li a {
    background:#EBF0FD;
    color:#336699;
    display:block;
    font-weight:bold;
    line-height:2.0em;
    margin:0px;
    padding:0px 25px;
    text-align:center;
    text-decoration:none;
}

.menu li a:hover, .menu ul li:hover a {
    background: #5E78B5 bottom center no-repeat;
    color:white;
    text-decoration:none;
}

.menu li ul {
    background:#EBF0FD;
    display:none;
    float: left;
    height:auto;
    padding:0px;
    margin:0px;
    border-style:solid;
    border-color:#C9D8FF;
    position: absolute;
    right: 0;
    width:auto;
    z-index:200;
}

.menu li:hover ul {
    display:block;
}

.menu li li {
    background: bottom left no-repeat;
    display:block;
    float:none;
    margin:0px;
    padding:0px;
    width:200px;
}

.menu li:hover li a {
    background:none;
    color: #336699;
}

.menu li ul a {
    display:block;
    line-height:35px;
    font-size:12px;
    font-style:normal;
    margin:0px;
    padding:0px 21px;
    text-align:right;
}

.menu li ul a:hover, .menu li ul li:hover a {
    background:#5E78B5 left no-repeat;
    color:#ffffff;
    text-decoration:none;
}
  • 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-01T02:26:06+00:00Added an answer on June 1, 2026 at 2:26 am

    You can absolutely position your submenu and just align it to the right most part of your main menu, like so:

    First declare your li items as relative, to position the submenu properly:

    .menu li {
        float: left;
        padding: 0;
        position: relative;
    }
    

    Then declare your submenu as position:absolute along with the right:0 property, to position your submenu absolutely to the right edge of your main menu:

    .menu li ul {
        position: absolute;
        right: 0;
    }
    

    And then just position your submenu text to the right to complete the effect:

    .menu li ul a {
        text-align:right;
    }
    

    Edit: Demo

    • 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&#8217;Everest What PHP function
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am reading a book about Javascript and jQuery and using one of the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

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.