What steps can I take to incorporate a dropdown feature into my existing menu design?

I am currently working on a navigation menu that includes various subjects. One of the subjects is titled Equipment, and when I hover over it, Throwables and Gear appear. However, I now want to add another dropdown menu that opens when I hover over Throwables or Gear. I have tried different approaches, such as adding another ul or li element between the Gear li elements, but each time I attempt this, my entire menu becomes distorted. Despite searching for solutions on YouTube and Google, I haven't been able to achieve the desired outcome.

In summary: I would like to implement an additional dropdown menu that appears when hovering over Throwables or Gear. The new menu should open to the right and maintain the same blue color when hovered over. Here is an example of how I envision it looking (with the rest of the menu positioned to the left of Equipment).

Here is a snippet of the menu code:

.navigatie_menu{
  position: absolute;
  left: 505px;
  top: 95px;
  z-index: 2;
}

ul {
  padding: 0px;
  list-style: none;
  color: black;
}

ul li {
  float: left;
  width: 130px;
  height: 40px;
  background: rgba(223,223,223,0.95);
  line-height: 40px;
  text-align: center;
  font-size: 17px;
  color: black;
}

    ul li a {
  text-decoration: none;
  color: black;
  display: block; 
}

ul li a:hover {
  background-color: #94bfea;
}

ul li ul li {
  display: none;
}

ul li:hover ul li {
  display: block;
}
<ul class="navigatie_menu">
  <li><a>Equipment</a>
    <ul>
      <li><a href="Equipment/Gear.html">Gear</a></li>
      <li><a href="Equipment/Throwables.html">Throwables</a></li>
    </ul>
  </li>
</ul>

Answer №1

Is this what you had in mind?

        .navigation_menu {
            position: absolute;
            left: 505px;
            top: 95px;
            z-index: 2;
        }

        ul {
            padding: 0px;
            list-style: none;
            color: black;
        }

        ul li {
            float: left;
            width: 130px;
            height: 40px;
            background: rgba(223, 223, 223, 0.95);
            line-height: 40px;
            text-align: center;
            font-size: 17px;
            color: black;
        }

        ul li a {
            text-decoration: none;
            color: black;
            display: block;
        }

        ul li a:hover {
            background-color: #94bfea;
            display: block;
        }

        ul li ul li {
            display: none;
        }

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

        .sub_menu1 {
            position: absolute;
            left: 130px;
            display: none;
        }

        .sub_menu2 {
            position: absolute;
            left: 130px;
            display: none;
        }


        .gear:hover .sub_menu1 {
            display: block;
        }

        .throwables:hover .sub_menu2 {
            display: block;
        }
<body>
    <ul class="navigatie_menu">
        <li><a>Equipment</a>
            <ul>
                <li class="gear"><a href="Equipment/Gear.html">Gear</a>
                    <ul class="sub_menu1">
                        <li><a href="#">subject1</a></li>
                        <li><a href="#">subject2</a></li>
                        <li><a href="#">subject3</a></li>
                        <li><a href="#">subject4</a></li>
                    </ul>
                </li>
                <li class="throwables"><a href="Equipment/Throwables.html">Throwables</a>
                    <ul class="sub_menu2">
                        <li><a href="#">subject1</a></li>
                        <li><a href="#">subject2</a></li>
                        <li><a href="#">subject3</a></li>
                        <li><a href="#">subject4</a></li>
                    </ul>
                </li>
            </ul>
        </li>
    </ul>

</body>

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

Tips on utilizing CSS selectors with jQuery?

Is there a way to use jQuery to call a function on a web page load that will set the text "Hello world!" on all labels with the CSS class "hello"? I'm curious to learn more about how this works. Can anyone provide some insight? ...

The webpage loaded through ajax is not rendering correctly

One of the challenges I'm facing is getting a JavaScript script to load an HTML page into a specific div element on another HTML page: The page that's being loaded, startScreen.html, looks like this: <!DOCTYPE html> <html lang="en ...

Remove a data entry from the MySQL database by selecting the corresponding row in the table and utilizing the DELETE function

Is there a way to remove a record from my MySQL database by clicking on a row in a table that is generated using ejs? Below is the code I am currently using to generate the table rows. <% res.forEach(function(item){ %> <tr> ...

I noticed that my jquery code is injecting extra white space into my HTML5 video

Ensuring my HTML5 background video stays centred, full-screen, and aligned properly has been made possible with this jQuery snippet. $(document).ready(function() { var $win = $(window), $video = $('#full-video'), $videoWrapper = $video. ...

Prevent redirection on buttons within ionic lists

THE ISSUE: I am facing an issue in my Ionic app where I am using the ion-list component. Each item in the list can be swiped to reveal a button (add/remove to favorites). Additionally, each item serves as a link to another page. The problem arises when ...

What are some techniques for managing scrolling within a particular element?

I am currently working with Vue.js and utilizing Element UI components. I want to incorporate a scroll management function to achieve infinite scrolling. To better understand, please refer to the screenshot in the Example section: Despite trying differen ...

Sometimes, the page-wide background in Internet Explorer doesn't load properly

Currently, I am working on a website that uses an image as the background for the entire site. Everything seems to be running smoothly in Firefox and Safari, but Internet Explorer is giving me some trouble. Sometimes the image fails to load at all, other t ...

How can one make the image pop and stand out from its background?

I am trying to achieve a similar effect as shown in this design where the image stands out from its background. I have managed to do that, but I am struggling with aligning the image to the center and bottom with overflow. Can anyone help me with this? Th ...

Leveraging WordPress as a landing page integrated with a Silverlight backend

Currently, I am a web developer working on a project for a WordPress landing page that will eventually direct users to an all-Silverlight page. However, my programmer is claiming that this cannot be accomplished due to conflicts between PHP and Silverlight ...

HTML and Javascript Form Integration for Sage Pay Purchase Button

Currently, I am working on a project that includes online payment options via PayPal and Google Wallet, with a "buy now" button. Now, my next step is to incorporate the Sage Pay "buy now" button onto the website using HTML and JavaScript. Although I have ...

Center an image vertically and horizontally within a div element inside a container, even if the image sizes and aspect ratio differ, while also including padding

I am looking to vertically align images with varying ratios, where the image may be larger or smaller than the content and also include padding; I have tried different solutions found here, but none seem to cover all my requirements; I specifically need i ...

Flip an image by analyzing the colors beneath it

Looking for a way to invert the color of specific areas under a mask (PNG) for a floating menu. Rather than inverting all at once, I want only certain parts to be inverted underneath the mask. Is this achievable, or is there another approach I should consi ...

Adding text with jQuery

Currently, I am utilizing the Jquery text editor plugin known as JqueryTE. While adding some functions to it, I have encountered a roadblock. Specifically, I am attempting to insert additional text into the source of the textarea but have been unsuccessfu ...

CSS :hover problem, text appearing unexpectedly

I'm currently working on designing a logo that displays hidden text when hovered over, providing instructions to users. However, I've encountered an issue where the hidden text reveals itself even before the logo is hovered over. This is frustrat ...

Intelligent programming and innovative thinking to streamline template diversity

My goal is to create multiple child websites using a base HTML/CSS template. Each child website will have unique color schemes and image variations for elements like <h> tags and background colors. I am searching for ways to easily modify the base th ...

"Here's how you can mark an option as selected in Angular, either from the component or the HTML file

When it comes to my form, I have a select menu that sends data to an SQL database and then fetches it back when it is called for editing. The value being edited should be displayed in the select menu option as selected. Here's a peek at my code: < ...

After the animation finishes, the CSS3 :hover effect ceases to function

There seems to be an issue with my DIV element. When hovering, the background color changes to blue. However, when a button is clicked, a class is added which animates the background color to green. After this animation, the hover effect no longer works an ...

What steps can you take to ensure that a pre-loaded swf file occupies the entire browser

Allow me to elaborate on my query. I am currently designing a flash website and utilizing a small external preloader swf to load the main swf. I have successfully configured the preloader swf to occupy the entire browser window, however, once it loads in ...

Having trouble viewing a dynamically adjusting Angular NVD3 graph embedded in bootstrap

I have been utilizing the NVD3 library along with bootstrap 3.0 for my project. I have two divs with the classes "col-md-6 col-sm-12" positioned side by side. My goal is to showcase charts in both of these divs. To ensure that the charts are displayed corr ...

Retrieve data from an HTML form within an Angular 2 ag-grid component

I'm facing a challenge with incorporating form values from a modal into an ag-grid array in my HTML file. I'm unsure of the process to achieve this. Below is an excerpt from my file.html: <template #addTrainContent let-c="close" let-d="dismi ...