本文介绍了悬停在div上触发另一个div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我到目前为止。我想做的是,当我悬停在div book1 ,我想要div uploadbutton 。我似乎无法找到它。

This is what i have so far. What i would like to do is that when i hover on the div book1, I want the div uploadbutton to be shown. I cant seem to figure it out.

<style type="text/css">
  #uploadbutton {
   display:none;
  }
</style>

这是我的div,上面的一个是我的css风格

This is my div and the above one is my css style

<div id="book1">
<?php include 'viewing_display_pic.php'; ?>
</div>

<div id="uploadbutton">
<?php include 'upload.php'; ?>
</div>


推荐答案

您可以使用:

You can use adjacent sibling selector:

#uploadbutton {
  display: none;
}
#book1:hover + #uploadbutton {
  display: block;
}
<div id="book1">
  some random text
</div>

<div id="uploadbutton">
  some random text
</div>

这篇关于悬停在div上触发另一个div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 02:24