gpt4 book ai didi

html - CSS -> 悬停效果不起作用

转载 作者:太空宇宙 更新时间:2023-11-04 08:55:13 25 4
gpt4 key购买 nike

如果我的光标在 div 上,我的 CSS 代码没有检测到: 但是如果我使用浏览器开发工具激活“悬停”,它就可以工作。

解释:如果我越过一个按钮,div 显示,但 div 隐藏,如果我离开按钮...

我的代码:

.profilanzeige2 {
width: 20%;
float: right;
position: absolute;
text-align: center;
padding: 10px;
top: -250px;
right: 0px;
z-index: -1;
border-radius: 0px 0px 10px 10px;
color: white;
/* border: 1px solid #797979; */
background-image: none;
background: #16b751;
background: -moz-linear-gradient(top, #16b751 0%, #19ad46 100%);
background: -webkit-linear-gradient(top, #16b751 0%,#19ad4619ad46 100%);
background: linear-gradient(to bottom, #16b751 0%,#19ad46 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#16b751', endColorstr='#19ad46',GradientType=0 );
transition: top 1s ease-in-out;
border: 1px solid #e7e7e7;
}

#profilanzeige:hover ~ #profilanzeige2, .profilanzeige2:hover {
top: 54px !important;
}

#profilanzeige:hover + #profilanzeige2, .profilanzeige2:hover {
top: 54px !important;
}

.profil:hover ~ #profilanzeige2, #profilanzeige2:hover {
top: 54px !important;
}

.profil:hover + #profilanzeige2, #profilanzeige2:hover {
top: 54px !important;
}
<div class="profilanzeige2" id="profilanzeige2">
<img src="https://ftimg.de/images/2017/03/02/5e2c4f6af5024d26bb95d074a3ed9a86.png">

<p class="profil-name"><?php echo $user['icname']; ?></p>


<a href="profil.php"><button type="button" class="btn btn-default" class="Profilanzeigen">
Profil anzeigen
</button></a>

<a href="logout.php"><button type="button" class="btn btn-default" class="Abmelden" href="logout.php">
Abmelden
</button></a>
</div>

最佳答案

你有

<div class="profilanzeige2" id="profilanzeige2">

profilanzeige2:hover在#profilanzeige

为了可读性,可以改进的另一件事是在 div 中使用不同的类名称和 id。

关于html - CSS -> 悬停效果不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43158754/

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