How to display div with hovering on a nested div?


I want to display a different div with a hover effect from a nested div.

Shows that hovering on the nested div works.

.main-div > .nested-div:hover {
    border: 1px rgb(0, 0, 0) solid;

Hover effect for the div class I wanted to be displayed (does not work).

.main-div > .nested-div:hover + .display-this {
    display: block;

Class I want to be displayed.

.display-this {
    display: none;

Example of the divs in question:

<div class='main-div'>
    <div class='nested-div'>
        Hover Me
<div class='display-me'>
    Display Me



In order for it to work you need to move display-this into main-div

When you're using the + selector you say that you want to select the element next to the sibling element.

<div class='main-div'>
    <div class='nested-div'>
        Hover Me
    <div class='display-this'>
        Display Me

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at


Login to comment


How to display a div when hovering over another div

Hovering on Div

Hovering one item to display the child in another div

Display DIV when hovering another DIV's child CSS

How to display a div when hovering over an image using CSS/HTML + Transitions?

How to show div when hovering dynamically a link?

How to use <i> element for hovering container div

How to restrict scrolling to the div that mouse is currently hovering?

How to change span style while hovering a div?

Angular - Hovering div will display a container, but container disappears after trying to hover it

Hovering a div but not its a links

Hovering Div Elements

Div Not displaying on hovering

Select the curent div that in hovering

how to Display div in sequential?

how to create and display a div

Div background won't display with nested children

How to place a div below a nested div?

How to show tooltip only for a particular hovering div which are dynamically generated

How to change color on every element in div when hovering?

How to show / hide the second div by hovering the first one?

How to make the Div movable UP and DOWN using jquery Hovering

How to hide container div title when hovering inner elements?

How to trigger div visibility when hovering over list item in CSS?

How to change icon colour when hovering on enclosing div container

How to scroll up a div when hovering over another element

how to hide one div and hide another on hovering image or text?

Hovering over divs not affecting div

how to style display div over the other div

TOP Ranking