Expand the width of the drop-down menu items

Having trouble with my submenu dropdown menu... I want to increase the width of my submenu without affecting the main menu, but they seem to be interconnected and I need them to function independently.

.fancyNav{
    /* Styles for the UL element */
    overflow: hidden;
    display: inline-block;
    z-index:999;
  }
  .fancyNav li{
    /* Customizing the list items */
    background: #CCC;
    -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
    filter: alpha(opacity=10);
    opacity:.7;
    border-right: 1px solid rgba(0, 0, 0, 1);
    position:relative;
    float: left;
    list-style: none;
  }

  /* More CSS styling for Fancy Nav */

  ...
  
  

The issue lies in the submenu code:

ul ul li{
      float:none !important;
      display: block;
      padding: 2px;
  }
  ul ul{
      display:none;
      position:relative;
      z-index:2;
  }
  ul li:hover ul{
      display:block;
  }
  

Here's a snippet of the HTML Code:

<nav><ul class="fancyNav">

    <li id="quemsomos" class="menlog"><a href="index.php"><img src="imgs/Logo.png"  width="37" height="45" /></a></li>

    <li id="quemsomos"><a href="quemsomos.php?web=1"><font face="din" size="4">QUEM SOMOS</font></a>

      <!--start of sub menu-->
      <ul>
        <li><a href="#">Test DropDown</a></li>
        <li><a href="#">Test DropDown</a></li>
        <li><a href="#">Test DropDown</a></li>
      </ul>
    <!--end of sub menu-->

    </li>
    
  

Thank you!

Answer №1

Give this CSS a try:

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

Appreciate it!

Take a look at this JSFiddle link

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

My element is not being animated by Elementbyclass

Without Using JQUERY The animation I'm trying to create isn't functioning properly. I attempted to utilize document.getElementsByClassName, but it's not working as expected. There are no errors, but the element is not animating correctly. ...

AngularJS encountered an unhandled syntax error

My current approach involves utilizing the code below to display data fetched from Parse API into a table using AngularJS and Bootstrap. However, the JavaScript section where I have defined the controller doesn't seem to be running as expected. Below ...

Struggling to make fadeIn() function properly in conjunction with addClass

I've been struggling with this issue for quite some time now and I just can't seem to make it work. The JavaScript I'm working on involves using addClass and removeClass to display and hide a submenu element. While the addclass and removeCla ...

Is there a way to set the image result retrieved from the API call as the background image for my app?

In my current project, the user is able to input a city and the background of the page changes to display an image of that specific city. This image is obtained through an API call to Pixabay API, with the result stored in a variable named "background". Ho ...

Divide a page into two equal halves

I have been working on the code below. The circular icons function as navigation buttons. The collapsible list is located in the second div. My goal is to align the list to the right side of the navigation buttons. Despite trying to wrap the divs and us ...

Is there a way to position a ListItem (using React) in the lower left corner in this specific case?

import * as React from 'react'; import { styled, useTheme } from '@mui/material/styles'; import Box from '@mui/material/Box'; import MuiDrawer from '@mui/material/Drawer'; import MuiAppBar from '@mui/material/Ap ...

Conceal sub-menu icons within the jQuery User Interface Menu Widget

Is there a way to hide the submenu icon for the jQuery UI menu widget? The default value is set to ui-icon-carat-1-e. $(document).ready(function(){ $(function() { $( "#menu" ).menu({ icons: { submenu: false ...

CSS :empty selector failing to target elements

I have a situation where I utilized the :empty selector within the .error class. However, I'm encountering an issue where even if there is no content inside the div with the error class, the error class does not get removed entirely. Upon examination ...

How to ensure scrollbar adjusts to increasing height when using scroll:auto?

My <div> element has the style property scroll:auto. Whenever text is added to the <div> and the content height exceeds the default height, I find myself having to scroll down in order to see the latest lines of text that have been added. What ...

Exploring the possibilities of device orientation in combination with 3D transforms

Imagine a project that aims to create a cube with sides representing different geolocations. The cube's sides for east, west, up, ground, north, and south are meant to always point in their respective directions. To gather the necessary data, the proj ...

"Enhance your website with a dynamic carousel feature using Twitter Bootstrap's JavaScript

After researching various examples, I noticed that most of them only display one Item at a time. I want to have multiple active items displayed using thumbnails, but the examples I found show that the Item itself contains multiple thumbnails inside of it. ...

The removal of classList.remove() only eliminates the class itself, not its contents

My goal is to add one class and remove another class when the start quiz button is clicked. While the 'info_box' class is successfully added, the 'start_btn' class does not get removed; it just changes position (from flex to no flex). T ...

CSS: The relative positioned element now functions correctly with the inclusion of overflow-x

Is there a way to ensure that the images in the day_time_block cover the title class? I would also like all contents within the day_time_block to be displayed using overflow-x. However, when I add overflow-x: auto; to the scroll div, the images in the d ...

What are some alternatives to tables for displaying two lines of headings and corresponding data?

Here is a snippet of HTML code I am working with: <div><span class='top'>Answered</span></div><div id="hour">15</div> <div><span class='top'>Not Answered</span></div ...

Ensure that the width of the table rows (tr) matches the width of the table header

I'm currently working on implementing a sticky table header. The issue I'm facing is that the width of tableHeaderRow does not match the width of tableHeader. Steps taken for creating sticky header: Make an Ajax call to populate the table with ...

Is there a way to adjust the border color of my <select> element without disrupting the existing bootstrap CSS styling?

In my Bootstrap (v4.5.3) form, the select options appear differently in Firefox as shown in the image below: https://i.sstatic.net/3suke.png Upon form submission, I have JavaScript code for validation which checks if an option other than "-- Select an Op ...

Tips to prevent elements from overlapping in Angular applications

I am facing an issue with my Angular-based app where I dynamically populate the page with table rows. There is an app-console element below the page that has a fixed position. Whenever I click the button to add a new row, it overlaps with the app-console. ...

Is there a way to verify the identity of two fields using an external script such as "signup.js"?

My current project involves working with Electron, and it consists of three essential files. The first file is index.html: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <link rel="styles ...

Adjustable textarea with automatic height based on content and line breaks

Imagine you have a textarea with text that includes line breaks. If you style it like this: textarea { height: auto; overflow: hidden; resize: none; } Upon loading the page, the textarea will only adjust its height based on the content until it enc ...

Locate an element that is nested within a "concat(" XPATH using Selenium

Embarking on my inaugural project as a Python developer, I am currently in the process of web scraping a retail website. The challenge lies in the fact that the site features infinite scrolling functionality, although at times instead of triggering the inf ...