Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
314 views
in Technique[技术] by (71.8m points)

reactjs - how to make a div hover over another div instead of below

I have a parent div and inside the parent div there are nested divs. What I want to do is when I hover the last child, I want it to hover over the borders of the parent divs instead of under the parent divs.

<div className="parentDiv">
 <div className="childA">
  <div className="childB">
   <div className="childC">
    {conents}
   </div>
  </div>
 </div>
</div>

The css goes here

 .parentDiv {
     display: flex;
     position: relative;
     height: 100%;
     width: 100%;
    }
    
    .childA {
     position: relative;
     width: 100%;
     height: 100%;
    }
    
    .childB {
     position: relative;
     width: 100%;
     height: 100%;
    }
    
    .childC {
     position: relative;
     width: 100%;
     height: 100%;
     transition: transform 450ms;
    }

.childC:hover {
      transform: scale(2.08);
      position: absolute;
      zIndex: 10;
    },

This is what I have tried so far. But I cant make it hover over the parent div borders.

question from:https://stackoverflow.com/questions/65918655/how-to-make-a-div-hover-over-another-div-instead-of-below

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

.childC:hover .parentDiv{
    border:2px solid black;
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...