Problem encountered with submenu text in CSS drop-down menu

Hey there! I've recently started working on a website and encountered a problem while trying to create a dropdown menu using CSS and HTML. The hover function for the submenu is functioning properly, but I'm struggling with changing the font color to black when hovering over the menu to access the submenu. You can check out the page where I'm testing the code here:

Here's the code I have:

CSS:

body {margin:0;
    padding:0;
    background:#000000
}

.image{
    border: none;
    border:0px;
    margin:0px;
    padding:0px;
    z-index: -1;
}


.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;
    z-index:2;
}
.menu ul{
    background:#FFFFFF;
    height:50px;
    list-style:none;
    margin:0;
    padding:0;
    -webkit-border-radius: 15px;
    -moz-border-radius: 15px;
    border-radius: 15px;
    -webkit-box-shadow: inset 0px 16px 0px 0px rgba(255, 255, 255, .1);
    -moz-box-shadow: inset 0px 16px 0px 0px rgba(255, 255, 255, .1);
    box-shadow: inset 0px 16px 0px 0px rgba(255, 255, 255, .1);
}
.menu li{
    float:left;
    padding:0px 0px 0px 15px; 
}
.menu li a{
    color:#000000;
    display:block;
    font-weight:normal;
    line-height:50px;
    margin:0px;
    padding:0px 25px;
    text-align:center;
    text-decoration:none;
}
.menu li a:hover{
    background:#000000;
    color:#FFFFFF;
    text-decoration:none;
    -webkit-box-shadow: inset 0px 0px 7px 2px rgba(0, 0, 0, .3);
    -moz-box-shadow: inset 0px 0px 7px 2px rgba(0, 0, 0, .3);
    box-shadow: inset 0px 0px 7px 2px rgba(0, 0, 0, .3);
}
.menu ul li:hover a{
    background:#000000;
    color:#FFFFFF;
    text-decoration:none;
}
.menu li ul{
    display:none;
    height:auto;
    padding:0px;
    margin:0px;
    border:0px;
    position:absolute;
    width:200px;
    z-index:200;
}
.menu li:hover ul{
    display:block;      
}
.menu li li {
    display:block;
    float:none;
    margin:0px;
    padding:0px;
    width:200px;
    background:#FFFFFF;
    /*this is where the rounded corners for the dropdown disappears*/
}
.menu li:hover li a{
        background:none;
}
.menu li ul a{
                display:block;
        height:50px;
        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{
    border:0px;
    color:#ffffff;
    text-decoration:none;
    background:#000000;
    -webkit-box-shadow: inset 0px 0px 7px 2px rgba(0, 0, 0, .3);
    -moz-box-shadow: inset 0px 0px 7px 2px rgba(0, 0, 0, .3);
    box-shadow: inset 0px 0px 7px 2px rgba(0, 0, 0, .3); 
}   

HTML:

<div class="image">   
    <img src="/Resources/img/Header.png" width=100% style={margin:0;padding:0;}/></img>
</div> 
<div class="menu">
    <ul>
        <li><a href="#" >Home</a></li>
        <li>
            <a href="#" id="current">About</a>
            <ul>
                <li><a href="#">Company Info</a></li>
            </ul>
</div>

I would greatly appreciate any help in solving this issue!

Answer №1

Updated:

Replace the line below

.menu ul li:hover a

with this updated line:

.menu ul li:hover > a

This change makes it more specific.

VIEW DEMO

Answer №2

After adjusting your html which had some errors and eliminating certain redundant elements, I also made modifications to your css by removing unnecessary selectors and revising others.

Do you think this is closer to what you had in mind?

Answer №3

Insert color:#000 to the CSS for .menu li:hover li a:

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

 }

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

Styling JavaFX ChoiceDialog with CSS

I'm currently struggling with customizing the appearance of a ChoiceDialog in my JavaFX application using CSS. While I've successfully applied styles to other dialog panes, it seems that the ChoiceDialog is not responding as expected, possibly du ...

AngularJS allows for emitting the value from a search button based on the current state of a checkbox

Within my application, there is a Search Button that interacts with an internal API using a GET Request. This API retrieves Data that is sometimes protected. To simulate the Back-End behavior, there is a checkbox that is initially set to true. If the chec ...

Does anyone know how to designate a Thumbnail when playing Audio on iOS Safari?

I recently launched a website to showcase my new podcast. The audio is embedded in a media player on the page, and when it's playing, it shows up on the Control Center audio tab and even on the lock screen. However, the thumbnail displayed is just a ...

Produced inputs and preset values

I have a question regarding the use of generated input elements in my App's form. I want to keep it as simple as possible, which is why I am using native form reset for these elements. It appears that the 'default value' becomes bound to th ...

Steps for executing the jQuery script are as follows:

A friend shared this code with me and it's working perfectly here http://jsfiddle.net/WVLE2/ I tried replicating it on an HTML page below, but unfortunately, it's not working. I'm still learning jQuery and would appreciate any help on how t ...

I recently implemented a delete function in my code that successfully removes a row, but now I am looking to also delete the corresponding data from localStorage in JavaScript

I have successfully implemented a delete function in JavaScript that deletes rows, but I also want to remove the data from local storage. This way, when a user reloads the page, the deleted row will not appear. The goal is to delete the data from local s ...

What is the best way to display an HTML page in the bottom right corner instead of within a div?

I am trying to display the content of an HTML page in the bottom right corner of another page using my JavaScript script. However, I do not want to insert a div into the page and then load the content inside it. Instead, I am looking for an alternative way ...

What is the best method for flipping the sequence of elements in media queries?

I am facing an issue with two divs, left and right, on my webpage. When the screen size is less than 500px, I want the left div to move to the bottom and the right div to move to the top. Essentially, I need to swap the positions of these divs in the DOM. ...

"Interactive elements like dropdown menus and clickable buttons that transform the content of an HTML

My webpage includes three buttons that, when clicked, reveal hidden div elements containing forms. Here is the HTML code for the buttons: <button id="edituser" type="submit" onclick="toggle_visibility('c');" style="border:0;width:100px;margin ...

Placing a div on top of a link renders the link unusable

I am facing a situation and require assistance (related to HTML/CSS/JS) I currently have a div containing an image (occupying the entire div space) such that when hovered over, another div with an image is displayed on top (the second div is semi-transpar ...

``In Internet Explorer, the function to swap the image source when hovering over the parent element

I'm trying to make it so that when I hover over the parent (Li) tag with my mouse, the src attribute of the child img tag changes. This code works correctly in Chrome but not in Firefox and Internet Explorer. <li class="player"> . . //some c ...

What is the best way to apply a border to the entire vertical line in a Bootstrap table?

I have utilized bootstrap to create the table displayed below. View image here I am looking to incorporate a vertical red line similar to the one shown in the image below. Additionally, I would like to add a drop shadow along with the red line. View ima ...

Steps to launching a URL in a new window on Internet Explorer

I want it so that when button1 is clicked, the URL opens in a new window using Internet Explorer. ...

The Google API is experiencing issues when using input that has been added on

Situation: In my attempt to integrate a Google address search feature into an online shopping website, I encountered a challenge. I don't have direct access to the website's HTML code, but I can insert code snippets in the header, footer, and in ...

Personalized navigation bar using the Bootstrap 5 framework

I am seeking to create a unique custom navbar layout with specific requirements: A centered logo 3 collapsible menu buttons on the left 2 icons (account and Instagram) on the right, always visible When the left menu is collapsed, I want to display a hamb ...

Make sure to load the HTML content before requesting any input from the user through the prompt function

Could you please help me with a question? I'm looking to load HTML content before prompting the user for input using JavaScript's prompt() function. However, currently the HTML is only loaded after exiting the prompt. Below is the code that I hav ...

Adjust element based on the position of another element (sticky)

Is it possible to rotate a text block so that it remains anchored to the bottom of a red rectangle, even when the rectangle is rotated? Similar to how it works in Figma, but simpler. For example, if I rotate the rectangle by 180 degrees, the text should be ...

How to Apply CSSResource to Customize a GWT Hyperlink

Hello, I am looking to enhance the visual appeal of my web application using GWT CSSResource. One thing that I am struggling with is styling a simple hyperlink. In traditional CSS, I would typically do the following: a{color: #somecolor} a:hover{color: ...

Is it possible for a div to extend beyond the previous div's boundaries using CSS?

When viewing a website like GameFAQs, you may notice that there are two divs positioned next to each other - the main content and an aside (such as a poll). As you resize the window, the aside sometimes moves down below the main content without leaving any ...

Migration of Bootstrap Template to ASP.NET 4.5 Forms and Addressing Rendering Problems with Full Width Display

is a Bootstrap Template that I purchased and incorporated into my project. After migrating it to an ASP.NET 4.5 Web Forms setup, I encountered issues with the LayerSlider and Footer not rendering correctly in full width as they did on the original template ...