Dropdown menu obscured by other elements or unresponsive

While designing a drop-down menu for my website, I encountered an issue. The menu appears when I hover over it, but as soon as I move the mouse pointer on top of it, the menu disappears. Adjusting the line height under "ul.menu li > a" helped to some extent, but didn't completely solve the problem. I also experimented with the "z-index" property without any success.

Below is the CSS code:

ul.menu {
display: inline;    
padding: 0px;
margin: 0px;
z-index:999;
}

#black_lay {
display:none;
position: absolute;  
left: 0%;
top: 0%;
background-color: black;
-moz-opacity: 0.7;
-webkit-opacity: 0.7;
opacity: .70;
filter: alpha(opacity=70);
width: 100%;
height: 100%;
z-index: 90;
}

#overlay {
display: none;
position: absolute;
left: 25%;
top: 25%;
padding: 25px; 
border: 2px solid black;
background-color: #ffffff;
width: 50%;
height: 50%;
z-index: 100;
}

ul.menu li {
position:relative;
cursor: pointer;
-webkit-transition: padding .05s linear;
-moz-transition: padding .05s linear;
-ms-transition: padding .05s linear;
-o-transition: padding .05s linear;
transition: padding .05s linear;
}

ul.menu li.drop {
position: relative;
}

ul.menu > li {
display: inline-block;  
}

ul.menu li > a {
line-height: 80px;
padding: 0 1px;
-webkit-transition: all .1s ease-out;
-moz-transition: all .1s ease-out;
-ms-transition: all .1s ease-out;
-o-transition: all .1s ease-out;
transition: all .1s ease-out;
}

.dropOut .triangle {
width: 0;
height: 0;
position: absolute;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 8px solid white;
top: -8px;
left: 50%;
margin-left: -8px;
}

.dropdownContain {
width: 160px;
position: absolute;
z-index: 9000000;
left: 50%;
margin-left: -80px;
top: -400px;
}

dropOut {
width: 160px;
background: white;
float: left;
position: relative;
margin-top: 0px;
opacity: 0;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: 0 1px 6px rgba(0,0,0,.15);
-moz-box-shadow: 0 1px 6px rgba(0,0,0,.15);
box-shadow: 0 1px 6px rgba(0,0,0,.15);
-webkit-transition: all .1s ease-out;
-moz-transition: all .1s ease-out;
-ms-transition: all .1s ease-out;
-o-transition: all .1s ease-out;
transition: all .1s ease-out;
}

dropOut ul > li {
list-style: none;   
}

dropOut ul {
float: left;
padding: 10px 0;
 }

dropOut ul li {
text-align: left;
float: left;
width: 125px;
padding: 12px 0 10px 15px;
margin: 0px 10px;
color: #777;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-transition: background .1s ease-out;
-moz-transition: background .1s ease-out;
-ms-transition: background .1s ease-out;
-o-transition: background .1s ease-out;
transition: background .1s ease-out;
}

dropOut ul li:hover {
background: #f6f6f6;
}

ul.menu li:hover a { color: white; }
ul.menu li:hover .dropdownContain { top: 45px; z-index: 500;}
ul.menu li:hover .underline { border-bottom-color: #777; }
ul.menu li:hover dropOut { opacity: 1; margin-top: 15px; }

Here's my HTML:

<nav style="display:inline">
    <ul class="menu">
        <li class="drop">
            <a>Username</a>
            <div class="dropdownContain">
                <div class="dropOut">
                    <div class="triangle"></div>
                    <ul>
                        <li>Account</li>
                        <li>Logout</li>
                    </ul>
                </div>
            </div>
        </li>
    </ul>
</nav>

Answer №1

The issue you are encountering is likely due to this specific code:

ul.menu li:hover a { color: white; }

By setting the text color to white on hover, it makes the tab appear as if it has disappeared.

I tested changing the color in a fiddle and confirmed that it functions correctly with a different color.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Premature adjustment of images to window size changes

How can I make the images inside a divider move down when the right-end of the browser reaches them? Currently, they start moving down before the edge of the window is reached. Any suggestions on how to fix this? JSFIDDLE: https://jsfiddle.net/prtdaay1/2/ ...

Switching Text Box Content When Hovering Over a Static Element: A Fail-proof Method

Even though I followed the solution from another source, the Description I set still refuses to show up in the text box. I have already attempted this: How To Change Text Box Content On Hover I meticulously checked every class name and every bracket in th ...

Implement a floating div below an accordion element on the page

As depicted in the image, there is a "Quick Tips" div located below the accordion. Let's assume the outermost div is named id="TipsDiv". The goal is to ensure that this div remains below the accordion as the user scrolls down, never going above positi ...

Tips for displaying the number of selected values in a select box label (e.g. Choose an Option)

I am currently using the jQuery multiselect API in my application to allow users to select multiple values. However, I am facing an issue where I need to fetch all the selected values when a button next to the multiselect box is clicked. Unfortunately, I h ...

Having difficulty automating the selection of dropdown menu using Selenium in Python

I'm struggling to automate the selection of a specific element on this webpage using Selenium in Python. The elements I'm targeting from the webpage are as follows: https://i.sstatic.net/d4xcH.png Upon inspecting the page element, I found this ...

Having trouble locating specific elements on Yahoo News with Selenium in Python?

I am currently facing some challenges with extracting comments from Yahoo News using Selenium. I have successfully clicked on the comments button to open it, but now I am struggling to locate the text of the comments section. from selenium import webdriver ...

Effortlessly browse through directory with the seamless integration of AngularJS or

Hey there! I'm working on a really cool feature - creating a list with editable inputs. However, I've encountered a bit of an issue. Is there any way to navigate through this list using arrow keys and focus on the desired input? .content ul { ...

Tips for creating a margin on an HTML button's background color

My bootstrap button has dimensions of 46 x 96px and a border radius of 22px. When hovered, I would like the background color to only extend up to 40 x 90px, without filling the entire button. I understand this can be achieved using a box-shadow, but since ...

Ways to decrease the width of a outlined material icon

Is there a way to adjust the appearance of this icon to make it appear thinner? I have tried using font-weight and stroke-width without success. .material-icons-outlined, .material-icons.material-icons--outlined { font-family: 'Material Icons Out ...

JQuery is unable to access the initial JQuery objects when a new div is loaded during an AJAX event

My page contains many JQuery objects. Also, there is a form where users can input search terms in different fields and click a search button to send an AJAX request to the server. The resulting HTML is then loaded into a div. However, I am facing an issue ...

Apply a CSS class to specific text inputs with an "onclick" attribute

Need help with text inputs that have onclick functions. Looking to assign a specific CSS class to text inputs with a certain onclick function. Attempted to use this jQuery code: $(document).ready(function(){ $('input').each(function() { ...

Aligning a button and textbox to have equal heights side by side

Is there a way to update the default form styling for two form elements so that the text box and button have the same height and are positioned side by side to create the illusion of one element? While it appears correctly in some browsers, in others they ...

Having trouble with Vuejs Ternary Operator or Conditional in v-bind-style?

Having some unexpected issues while trying to implement a style conditional for items in Vuejs. I have come across Stack Overflow posts on how to use a ternary, either through an interpolated string or a computed style object. I've attempted both met ...

Please enter either a single digit or multiple digits that are all the same

In my Vue.js project, I am working on a custom input field component that should only accept positive integers (including 0). Rather than using regex for validation, I prefer to keep the code human-readable :) The parent component that utilizes this input ...

Tips for arranging two jumbotrons with proper spacing in Bootstrap without stacking them vertically while using the mr-1 class

My issue involves two jumbotrons, each with a col-md-6 class, positioned nicely next to each other. Currently, they are contained within a modal, but for the sake of example, I have created a fiddle without the modal to showcase the same behavior. If I app ...

Is there a way to verify the selection of all mandatory fields prior to concealing a div?

var count = 2; $('.next').click(function() { var requiredField = true; $(this).siblings('table').find('tbody tr:nth-child(' + count + ') td').each(function() { var element = $(this).find('center').f ...

What methods can be used to disable the back button functionality within an iframe?

I am facing an issue with embedding YouTube links on my webpage using iframes. When a user clicks on the link, it plays the video in the iframe. Below is the HTML and jQuery code I am using: HTML: <a href="http://www.youtube.com/embed/Q5im0Ssyyus"> ...

Tips for incorporating a CSS class or id into Html.PagedListPager

Currently utilizing a PagedListPager: @Html.PagedListPager((IPagedList)Model, page => Url.Action("InboxWithNoReplyListPaging", new { page = page }), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(new AjaxOptions() { HttpMethod = "G ...

The functionality of Jquery to update the display styling using CSS is not functioning properly

Here is the code snippet: <script type="text/javascript> $(window).load(function(){ debugger $('#comp').ready(function() { $('#QV101').css("display", "inline"); $(' ...

Creating a dynamic duplication feature for a form's text area

As a newcomer to the world of Javascript, I am embarking on creating a review-writing page. However, I have hit a roadblock in my progress. The main issue I am encountering is implementing a button that allows users to add a new section by duplicating an ...