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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:10:14+00:00 2026-05-30T13:10:14+00:00

When you mouseover a navigation item, the colour of the link changes to white

  • 0

When you mouseover a navigation item, the colour of the link changes to white and background of that link goes black. The hover state does a display:block on a hidden nested . When I move the mouse over to the nested (i.e. the sub menu), the hover state on the top-level nav returns back to the way it was. How do I make it persist whilst my mouse is over the sub-menu?

In other words, when I hover the link ‘What we do’, the font color changes to #fff and background to #111 and the ul.sub-menu appears with the same black background and white text. This all appears whilst my mouse hovers over ‘What we do’, but as soon as it moves to the sub-menu, the background on ‘What we do’ returns to its original color and font color changes back to black. Meanwhile my sub-menu remains open in the correct format. How do I get the ‘state’ to persist when I move the mouse hover away?

Here is a jsfiddle for it: http://jsfiddle.net/U77re/

nav ul#menu-top-nav { position: absolute; top: 35px; left: 113px; padding: 16px 30px 17px 20px; width: 797px; background: #F0F1F4;}
nav ul#menu-top-nav li { position: relative; float: left; margin: 0 40px 0 0; }
nav ul#menu-top-nav li a:hover { color: #fff; background: #111;  }
nav ul#menu-top-nav li#menu-item-1186 { margin-right: 0; }
nav ul#menu-top-nav ul.sub-menu { display: none; }
nav ul#menu-top-nav ul.sub-menu li a { margin: 0; }

nav ul#menu-top-nav li:hover ul.sub-menu { display: block; position: absolute; left:0; top: 30px; width: 250px; padding: 20px;
                                    z-index: 1; background: #111; }

nav ul#menu-top-nav  ul.sub-menu p { margin: 0 0 25px 0; color: #fff; line-height: 1.4; font-weight: bold; }
nav ul#menu-top-nav  ul.sub-menu li { width: 250px; margin: 0 0 20px 20px; color: #fff; list-style-position: inside; list-style-type: disc;  }
nav ul#menu-top-nav  ul.sub-menu li a { color: #fff;  }

<nav role="navigation">
    <ul class="menu" id="menu-top-nav">
    <li id="menu-item-1596"><a href="http://localhost:8888/what-we-do/">What we do</a>
        <ul class="sub-menu">
            <p>Explore what we do and the people behind it</p>
            <li id="menu-item-1600"><a href="/what-we-do/about/">About IFSW</a></li>
            <li id="menu-item-1604"><a href="/what-we-do/partners/">Partners</a></li>
            <li id="menu-item-1601"><a href="/what-we-do/contact/">Contact</a></li>
        </ul>
    </li>
</ul>
</nav>
  • 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-30T13:10:14+00:00Added an answer on May 30, 2026 at 1:10 pm

    Switch your hover event from the a anchor element to the li element, like so:

    nav ul#menu-top-nav li:hover a { color: #fff; background: #111;  }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need some help assigning a mouseover event to display some icons that start out
i've a navigation bar like the one below..for each it changes the background color
I have a navigation that uses jQuery and CSS to control image mouseover positioning
http://www.izrada-weba.com/orso On mouseover on link NENATKRIVENA TERASA... submenu and image fade in together. Submenu
I am using a table navigation menu in my website in that i have
I'm using the jQuery UI Accordion with the navigation: true toggled. With that, URL's
I would like to have multiple animations fire on mouseover for some navigation buttons.
I am actually changing the color of link & its background on mouse over.
I'm building a navigation bar where the images should be swapped out on mouseover;
I have a navigation that is hidden out of the viewport via css and

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.