Display the menu upon activating the hover event icon using only CSS

Assistance Needed - Unable to activate hover and display the rest of the div

  • I want to activate the hover effect where early levels are visible, and when hovering over the first level, the subsequent levels appear
  • List item

body { margin: 3%; }
div.title { 
    position: relative;         
    margin-right:2%; 
    border: 2px solid orange;
    background-color:orange;
    border-radius: 2px; 
    height: 400px; 
    width:36px; 
    float: left;        
}

.title:before { 
  position: absolute; 
  content:""; 
  border-top: 6px solid white; 
  border-bottom: 17px double white; 
  height: 5px; 
  width:30px; 
  top: 4px; 
  right:3px; 
}

.title:hover:before { 
  position: absolute; 
  content:""; 
  width:auto;
  top: 11px !important; 
  left:1px !important; 
  border-left: 16px solid rgba(255, 255, 255, 0) !important; 
  border-right: 16px solid rgba(255, 255, 255, 0) !important; 
  border-top: 16px solid white !important;
  border-bottom: none; 
  background-color:orange;
}


.item,.desplegable {
    display: none;
}
<div class="menu-option">
 
    <div class="title">
    </div>
    <input name="__RequestVerificationToken" type="hidden" value="CiVpO4FRnoe021mD68+lxPfMwBZygSRro9kFFZbmFzG89tqDv0QuHAyxo8Nsldeh8DkoVzd9+S0N7OGQhZtazNeFsmQ2ov4iuEfVCEYiHia4PVRRBCpIs/U2HvbjpffahdVYtabrA8p/XVy4TO8bh1ToRRY=">
    <div class="item">
        <a href="/Home/Index" class="formsMenu">
            <li class="viñeta3">Inicio</li>
        </a>
    </div>
    <ul class="padre">
        <a class="desplegable" href="#">
            <li class="viñeta3 viñetablanca desplegable">Administración dt</li>
        </a>
        <ul class="request-list subnavegador viñeta3" style="display: block;">
                <div class="item">
        <a href="/Campaign/List" class="formsMenu">
            <li class="viñeta3">Campañas</li>
        </a>
    </div>
    <div class="item">
        <a href="/Categories/List" class="formsMenu">
            <li class="viñeta3">Categorias</li>
        </a>
    </div>
    <div class="item">
        <a class="formsMenu">
            <li class="viñeta3" onclick="getForms()">Formularios</li>
        </a>
    </div>
    <div class="item">
        <a href="/PerformanceIndicator/List" class="formsMenu">
            <li class="viñeta3">Indicadores</li>
        </a>
    </div>
    <div class="item">
        <a href="/Hierarchies/List" class="formsMenu">
            <li class="viñeta3">Jerarquias</li>
        </a>
    </div>
    <div class="item">
        <a href="/Account/List" class="formsMenu">
            <li class="viñeta3">Usuarios</li>
        </a>
    </div>
    <div class="item">
        <a href="/StrategySettings/Index" class="formsMenu">
            <li class="viñeta3">Configurar estrategias</li>
        </a>
    </div>
    <div class="item">
        <a href="/ObjectPermissions/Index" class="formsMenu">
            <li class="viñeta3">Configurar permisos</li>
        </a>
    </div>
    <div class="item">
        <a href="/RedisCache/Index" class="formsMenu">
            <li class="viñeta3">Administracion REDIS caché</li>
        </a>
    </div>

        </ul>
    </ul>
    <ul class="padre">
        <a class="desplegable" href="#">
            <li class="viñeta3 viñetablanca desplegable">Nuevas Solicitudes</li>
        </a>
        <ul class="request-list subnavegador viñeta3" style="display: block;">
                <div class="item">
        <a class="formsMenu" onclick="CreateRequest('56ae9c06-7114-4d2a-9f9e-0f678b3130f4')">
            <li class="viñetablanca2">Credito Nuevo</li>
        </a>
    </div>

        </ul>
    </ul>
    <div class="item">
        <a onclick="WorkList('d5fe1e3d-2e08-41c2-9c62-0c57607de500','spGetAvailableInterviewsUser',0) " class="formsMenu">
<li class="viñeta3">Mis Solicitudes</li>        </a>
    </div>
    <div class="item">
        <a href="/Request/List" class="formsMenu">
            <li class="viñeta3">Busqueda de Solicitudes</li>
        </a>
    </div>

</div>

Answer №1

Utilize the 'element1 ~ *' selector to target all siblings of element1 that come after this element. Additionally, you'll need to adjust the input type as CSS alone cannot modify it.

body { margin: 3%; }
div.title { 
    position: relative;         
    margin-right:2%; 
    border: 2px solid orange;
    background-color:orange;
    border-radius: 2px; 
    height: 400px; 
    width:36px; 
    float: left;        
}

.title:before { 
  position: absolute; 
  content:""; 
  border-top: 6px solid white; 
  border-bottom: 17px double white; 
  height: 5px; 
  width:30px; 
  top: 4px; 
  right:3px; 
}

.title:hover:before { 
  position: absolute; 
  content:""; 
  width:auto;
  top: 11px !important; 
  left:1px !important; 
  border-left: 16px solid rgba(255, 255, 255, 0) !important; 
  border-right: 16px solid rgba(255, 255, 255, 0) !important; 
  border-top: 16px solid white !important;
  border-bottom: none; 
  background-color:orange;
}

.item,.desplegable, input[type="text"] {
    display: none;
}

.title:hover ~ *, .title:hover ~ * .item, .title:hover ~ * .desplegable {
    display: block;
}
<div class="menu-option">
 
    <div class="title">
    </div>
    <input name="__RequestVerificationToken" type="text" value="CiVpO4FRnoe021mD68+lxPfMwBZygSRro9kFFZbmFzG89tqDv0QuHAyxo8Nsldeh8DkoVzd9+S0N7OGQhZtazNeFsmQ2ov4iuEfVCEYiHia4PVRRBCpIs/U2HvbjpffahdVYtabrA8p/XVy4TO8bh1ToRRY=">
    <div class="item">
        <a href="/Home/Index" class="formsMenu">
            <li class="viñeta3">Inicio</li>
        </a>
    </div>
    <ul class="padre">
        <a class="desplegable" href="#">
            <li class="viñeta3 viñetablanca desplegable">Administración dt</li>
        </a>
        <ul class="request-list subnavegador viñeta3" style="display: block;">
                <div class="item">
        <a href="/Campaign/List" class="formsMenu">
            <li class="viñeta3">Campañas</li>
        </a>
    </div>>
    ... (remaining code continues)

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

auto-scrolling webpage as elements come into view

Here is some jQuery code I have: $(".col-md-12").hide(); $(".button-div").hide(); $(".featurette-divider").hide(); $(".footer").hide(); $(".first").fadeIn(1000); $(".second").delay(900).fadeIn(1000); $(".third").delay(1800).fadeIn(1000); $(".fourth").dela ...

POST method error 400 encountered

Whenever I execute my ajax jquery function, I encounter a 400 error Here is my code. All Postman tests pass successfully, but when the web app runs, it fails. I'm not sure if it's a coding issue or something related to HTML5. Can anyone offer as ...

What is the best way to navigate to the href link?

After attempting to use driver.find_element_by_id // link_text // partial link text without success, I'm wondering what method I should be using to access this href. Currently encountering a No Such Element Exception. Any assistance would be greatly a ...

Effect of Active or Focus on the HTML <ul> element

Check out this example of a UL tag: <ul style="list-style-type:none; padding:5px ; border:solid 1px #666666;"> <li>I am waiting </li> <li>I am waiting </li> <li>I am waiting </li> <li>I am wa ...

Javascript isn't being executed by Internet Explorer as expected

I'm currently working on a web application that requires backend processing while simultaneously showing the information on the screen. AJAX seems like the ideal solution, so I've implemented it in my project. However, before initiating the AJAX ...

Apache server is failing to perform HTML encoding

Currently working on a PHP code where a method is returning text to display an image. Here is the snippet of the code: $ret = "<div align=\"center\">" . "<image src=\"" . "${webserviceDir}Graph.php?usr_id=" . urlencode($usr_ ...

Access the website by logging in with idhttp

I'm attempting to log in to a website using Delphi / Indy. Currently, I only have a button (used to send a password / username) that calls this procedure. procedure TForm5.Login(name: string; Pass: string); var UserID :string; Password :string; res : ...

The download attribute is not functioning properly on both Chrome and Edge browsers

I've been trying to use the download attribute, but it doesn't seem to be working. I have also attempted to use the target attribute to see if there are any issues with downloading from the server or from a web (https) source. Unfortunately, noth ...

"Text that appears on a clear background when you hover over it

I'm attempting to have hidden text display inside a table cell upon hovering. I managed to achieve the hidden-until-hovered effect, but I am struggling to make the text appear solid in color (it currently decreases in opacity when hovered over). Is th ...

Problems with aligning elements to both the left and right sides of the same line

Currently, I have two divs that I would like to float on the left and right sides. However, they seem to be sticking together and I can't seem to separate them.. HTML: <nav> <div id="nav_content"> <div id="home_ico ...

Implementing jquery-confirm in CodeIgniter: A Step-by-Step Guide

I'm having some trouble with the jquery-confirm plugin from . Everything seems to be working fine, but when I try to delete an item, the jquery pops up an alert. However, when I click "okay", it doesn't actually delete the item. I can't figu ...

Prevent a div from scrolling once it reaches the end of its content, while allowing the other div to continue

I am trying to make the col-md-4 column stop scrolling once it reaches the end of the content, similar to the right sidebar on Facebook. I have attempted using jQuery to add a fixed position when it reaches the bottom, but it is not working as expected. Th ...

The menu will showcase all currently active sub-category items whenever an item below is selected (using Joomla/Mosets Tree)

I am currently managing a Joomla website that utilizes Mosets Tree for a business directory. One issue I have noticed is that on the right side of the site, all the categories are listed. When you expand sub-categories and then roll over to another menu it ...

What is preventing my counter from functioning when I click on the canvas?

I am attempting to increment the count every time a bouncing ball in the browser is clicked using this.setState({count: this.state.count + 1});. I thought my code was correct since I have done similar tasks before without using canvas, but it's not fu ...

Tips for sending php data to javascript efficiently

I'm wondering about the best way to retrieve HTML table rows and display the values on another page upon clicking a button. Ideally, I would like to store these variables in a session for future use. Any advice on how to proceed? ...

Hiding a button based on the visibility of another button in the user's viewport

Is there a way to dynamically hide button B when the user scrolls and button A becomes visible on the screen? Additionally, how can we show button B again once button A is no longer visible to the user? Both buttons should never be visible simultaneously. ...

Inconsistencies in Height Among JQuery Elements

I am encountering an issue with my datatable.js, where I am attempting to limit its height based on a specific row number, such as 4.5 rows. However, I am facing a problem with the row height (tr height). For example, when using the following method with m ...

I'm just beginning to delve into Python and have a question about Beautiful Soup

Recently, I attempted to extract the web crawling element from Google Drive. Specifically, I was looking for the file's modification date. To find the necessary elements, I used F12 and discovered the following selector: body > div.ndfHFb-c4Y ...

Issue with the functionality of max-height in a CSS grid container

Update: After receiving clarification from @onkar-ruikar, I realized that my original problem was quite misunderstood. While I still haven't figured out how to properly handle the cyclic dependencies issue, I decided to address it separately. As a res ...

Center the p tag vertically

To ensure the text inside the p tag aligns vertically in the middle, I've set a specific height for the tag. While this works perfectly for single-line text, it shifts to the top of the p tag when there are two lines of text. It's important to k ...