首页 > 解决方案 > 在 CSS 中结合悬停和之后的部署动画

问题描述

我有一个用 HTML 和 CSS 创建的按钮,当悬停在它上面时会显示文本。我想要实现的是有一个过渡动画,因为我一直无法做到。

在 HTML 代码中,按钮与链接a 标签一起使用。

希望他们可以重新创建代码。我留下了一个网站链接,以便您可以完整地查看它:https ://policies.esims.one/terms (该按钮是第一个出现在页面上的按钮。)

.back-button{
font-weight: bold;
letter-spacing: normal;
line-height: 100%;
text-align: center;
text-decoration: none;
border-radius: 0px;box-shadow: none;padding: 5px 30px 5px 5px;
color: #181818;
font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
font-size: 12px;
}
.back-button::before{
margin-right:10px;
background-image:url(https://mcusercontent.com/ec104f3d77537e1962ab6441c/images/d7bb4928-a156-4682-9677-d0d5b47c3a21.png);
background-size:40px 40px;
display:inline-block;
width:40px;
height:40px;
border-radius:50%;
content:""
}
.back-button:hover:after{
content:"Home"
}
.mcnButton{
transition:.4s;
border-radius:50px!important;
box-shadow:#999 0 0 20px 0!important;outline:none;
user-select:none
}
.mcnButton:focus{
background:#eceff9!important;
color:#181818!important
}
<div style="display:flex;">
<a class="back-button mcnButton" href="https://www.example.com/" target="_self">
</a>
</div>

标签: htmlcssanimation

解决方案


您好,我尝试使用您的code,如果您使用您的代码,它将完美运行:

<a class="back-button mcnButton" href="https://www.example.com/" target="_self"></a>

隐蔽为:

<a href="https://www.example.com/" target="_self">
<button class="back-button mcnButton"><button></a>

CSS也没有变化。


推荐阅读