gpt4 book ai didi

css - 动画工具提示淡入淡出

转载 作者:行者123 更新时间:2023-11-28 10:52:25 25 4
gpt4 key购买 nike

如何让这个工具提示显示和隐藏淡入淡出?我尝试添加:

transition: opacity .25s ease-in-out;
-moz-transition: opacity .25s ease-in-out;
-webkit-transition: opacity .25s ease-in-out;

但运气不好,这是我的代码

工具提示 CSS:

.mainButtonContainer button:hover:after
{

background: none repeat scroll 0 0 rgba(255, 255, 255, 0.7);
border-color: #093466;
border-radius: 5px 5px 5px 5px;
border-style: solid;
border-width: 7px 2px 2px;
bottom: -5px;
color: #093466;
padding: 5px 15px;
position: absolute;
width: 113px;
z-index: -1;
}

html:

<button  id=mgf_main1 type="button" onclick="loadData(1)">
<img src="Images/Magof-Icon.png" width="68" height="68"/>
</button>

jsfiddle.net/rdRhS

最佳答案

您需要将描述该元素的所有内容移动到 button:after,并且只更改在 button:hover:after 中悬停时发生变化的属性。

fiddle

button:after {
opacity: 0;

-webkit-transition: opacity .25s ease-in-out;
-moz-transition: opacity .25s ease-in-out;
transition: opacity .25s ease-in-out;

content:'';
background: none repeat scroll 0 0 rgba(255, 255, 255, 0.7);
border-color: #093466;
border-radius: 5px 5px 5px 5px;
border-style: solid;
border-width: 7px 2px 2px;
bottom: -5px;
color: #093466;
padding: 5px 15px;
position: absolute;
top:50px;
left:70px;
width: 113px;
height: 30px;
z-index: -1;
}

button:hover:after {
opacity: 1;
}

关于css - 动画工具提示淡入淡出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18446988/

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