vue 悬停显示另一个div_当有人将鼠标悬停在div上时显示另一个div

I have 2 separate div tags. I want div2 to appear when someone hovers over div1.

This is what I am trying to achieve..

HTML

HOVER TO ADD DETAILS

CSS

.div1{ background-color:#bcbcbc; width: 400px; height:45px;}

.div2{ display:none; position:relative; width: 50px; margin:0 auto;}

.div1 > .div2 {display:block; }

This is what I am trying.. It is not working. I am not able to show div2 when I hover div1. I've searched over the net but not able to find what I want. any idea how to do this. I would appreciate a css way of doing it. Thanks in advance..

解决方案

Make .div1 the child of .div2 like:

...

And then the CSS:

.div2 {

display: none;

}

.div1:hover > .div2 {

display: block;

}

.div2:hover {

display: block;

}

And also add your CSS.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值