gpt4 book ai didi

html - 将鼠标悬停在 div 上以触发另一个 div

转载 作者:行者123 更新时间:2023-11-28 16:08:43 24 4
gpt4 key购买 nike

这就是我目前所拥有的。我想做的是,当我将鼠标悬停在 div book1 上时,我希望显示 div uploadbutton。我似乎无法弄清楚。

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

这是我的div,上面的是我的css样式

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

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

最佳答案

您可以使用 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>

The adjacent sibling combinator is made of the "plus sign" (U+002B, +) character that separates two sequences of simple selectors. The elements represented by the two sequences share the same parent in the document tree and the element represented by the first sequence immediately precedes the element represented by the second one.

关于html - 将鼠标悬停在 div 上以触发另一个 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33566747/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com