The hover effect seems to be disabled in the third-level submenu

I need help creating a dropdown menu that shows an image when hovering over a specific item. I have checked my CSS code and HTML structure, but the image is not appearing as expected when I hover over the "Afyon White" list item. Any ideas on how to fix this?

/* regardless */
li {
  list-style: none;
  text-transform: uppercase;
}

/* theme.scss */
.MegaMenu__Inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: nowrap;
  flex-direction: column;
  margin: 0 auto;
  padding: 0 10px;
}

@media screen and (min-width: 1240px) {
  .MegaMenu__Inner {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* sca-jqueryblabla.scss */

.MegaMenu__Item {
  display: inline-block;
  position: relative;
  width: 5rem;
  transition: all 0.9s ease-in-out;
}

.MegaMenu__Item > .MegaMenu__Title {
  display: inline-block;
}

.MegaMenu__Item > .MegaMenu__Title:hover {
  transition: all 0.9s ease-in-out;
}

.MegaMenu__Title--dropdown {
  display: none;
  position: absolute;
  z-index: 1;
  width: 100%;
  margin-top: -1.5rem;
  margin-left: 4rem;
  width: 100%;
  transition: all 0.9s ease-in-out;
}

.DropdownList--li {
  width: 9rem;
  padding: 0.4rem;
}

.MegaMenu__Title--dropdown .DropdownList {
  display: block;
  position: relative;
}

.MegaMenu__Item:hover .MegaMenu__Title--dropdown {
  display: block;
  transition: all 9s ease-in-out;
}

.MegaMenu__Item.MegaMenu__Item--fit {
  cursor: pointer;
  padding: 0.5rem;
  text-align: center;
  background-color: white;
}

.MegaMenu__Item.MegaMenu__Item--fit a {
  text-decoration: none;
  color: #5c5c5c;
}

.MegaMenu__Item {
  position: relative;
}

.Linklist {
  position: absolute;
}

.DropdownList {
  position: relative;
  display: inline-block;
}

.color-nav {
  display: none;
  position: absolute;
  width: 10rem;
  height: 10rem;
  border: 3px solid black;
}

.DropdownList--li:hover .color-nav {
  display: inline-block;
}
<div class="MegaMenu__Item MegaMenu__Item--fit">
              <a href="" class="MegaMenu__Title Heading Text--subdued u-h7"
                >White</a>
              <div class="MegaMenu__Title--dropdown">
                <ul class="DropdownList DropdownList_White">
                  <li class="DropdownList--li DropdownList_White--li">
                    <a>Afyon White</a>
                  </li>
                  <div class="color-nav">
                    <img src="" alt="">
                  </div>
                  </ul>
               </div>
</div>

Answer №1

Ensure that the <div> shown below is nested within a <li> element with the classes DropdownList--li and DropdownList_White--li for proper selection based on your defined CSS style:

 <div class="color-nav">
         <img src="" alt="">
 </div>

The CSS you provided targets the .color-nav class as a child of .DropdownList--li, so make sure your HTML structure reflects this hierarchy.

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

Utilizing CSS3 to implement multiple backgrounds across various selectors

My goal is to set backgrounds in two different CSS classes, ideally utilizing CSS3's multiple background feature. I aim to achieve this with minimal markup and ensure it is universally applicable. For example: CSS .button { display: block; } . ...

Revamp the UI Framework's CSS to accommodate the latest Web Components

I've implemented Grommet as the UI Framework for my React page. However, I encountered a situation where certain web components, like a web chat control, are not covered by Grommet's CSS. What is the simplest way to style these additional web com ...

The dimensions of the bottom border on left floating divs are inconsistent

One of my designers frequently uses a particular technique in various designs, and I'm struggling to determine the most effective way to style it with CSS so that it fluidly adapts (as it will be incorporated into a CMS). Essentially, when implementi ...

Switch out div elements for td elements in HTML code

I have written a code snippet that successfully toggles between showing and hiding content. Here is the code: Simple collapsible Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliq ...

Hovers and click effects for navigating through images

The website I'm currently working on is stipz.50webs.com. p.s. HOME functionality is not active at the moment. Having successfully implemented the onhover and onmouseout features, my next goal is to enhance the navigation effects for each div/img so ...

Unexpected error occurs when modifying HTML5 video source using JQuery on Internet Explorer

Currently, I am working on developing a web application using asp.net, Bootstrap, and JQuery. While testing it on LocalHost, I encountered an issue that needs debugging. The navigation bar of my application has a dropdown menu with links to tutorial video ...

Script to pop up cancel alert box

There's a dilemma with this code - if you click CANCEL the first time the box pops up, it continues to run. I'm unsure of how to make it redirect to the underlying page when clicked on cancel for the first time. var numero= prompt ("Enter a nu ...

Tips for customizing styles when an element is being dragged over in Material-UI?

If I want to alter the backgroundColor when hovering, I can utilize sx={{"&:hover":{backgroundColor:"yellow"}} Is there a way to adjust the backgroundColor on dragover? It appears that sx={{"&:dragOver":{backgroundCol ...

"Executing ng-click directive on a second click changes the route in AngularJS

Why does my ng-click only redirect to a new location on the second click? It should redirect to $location.path('/login.signin');, but it only works if I click the button again. It's strange. Where could this issue be originating from? Belo ...

The variable in the HTML input value is not fully visible when filling out the HTML form

I am working with a Python Flask code where I have passed a dictionary to an HTML form. The table in the form correctly displays both keys and values, but when trying to populate a form field with the value from the dictionary, only the first word is displ ...

Update the color of a span in JQuery when its value equals 0

Currently, my goal is to update the color of a span tag only if its value is 0. I attempted to achieve this with the following code: $('span.number:contains("0")').css('color', '#C1C1C1'); However, this code also changes the ...

Employing regular expressions within Notepad++ to insert whole numbers into img src within table elements

I have a large table filled with numerous items that require individual images to be added. Let's take a look at the code snippet below. <tr><td><img src=".jpg" width=100 height=100/></td></tr> Although I could manually ...

How to switch around div elements using CSS

There are two unordered list items in a container div and one swap button. When the swap button is clicked, the order of items needs to change. This functionality can be achieved using the following swap function. var ints = [ "1", "2", "3", "4" ], ...

Issue with Material UI React: Navbar does not properly align the box to the right side

I'm facing an issue with my navbar that is supposed to align all the page options to the right. Despite using a flexbox layout and trying different alignment properties like alignSelf: end, the text only moves slightly downwards instead of aligning pr ...

"Mobile responsiveness issue: HTML email template table not aligning properly at the bottom on

Hello community, how is everyone doing? I'm currently working on creating my own HTML Email templates, but I'm facing some challenges with responsiveness. On desktop devices, the email looks like this: However, when viewed on mobile, I need th ...

Having trouble pinpointing the issue with this particular if statement?

I am currently working on creating a form that compiles all entered data when the user fills out all fields. The form is connected to a PHP file and functions properly, but I encountered issues when implementing validation logic. The "Validation" section ...

Can someone provide a method to automatically align bootstrap 5 footers within a set of cards?

Trying out this HTML code in Bootstrap 5, I noticed that the third column appears longer than the first two columns: <!-- bootstrap scripts --> <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_ ...

Guide on creating a toggle effect for a div with querySelector and addEventListener

I utilized the email and password divs provided by Bootstrap. The CSS for the id dropdownlogin includes display: none; in this post, I hope that I have shared adequate information. <script> document.addEventListener('DOMContentLoaded', ...

What is the best way to display multiple HTML files using React?

Looking to develop a web application using React that consists of multiple HTML pages. For instance, login.html and index.html have been created and linked to URIs through the backend - resulting in localhost:8080/login and localhost:8080/index. However, R ...

Tips for creating a navigation system that combines both horizontal and vertical bars

Is there a way for me to have both horizontal and vertical navigation bars on my website? I am new to design and struggling to understand why my CSS isn't working properly when applied to multiple links. <body> <div class="horizontallinks" ...