【问题标题】:Transition not easing out when un-hovering悬停时过渡没有缓和
【发布时间】:2017-12-26 20:53:03
【问题描述】:

我正在制作一个带有 CSS 下划线缓动过渡的简单按钮。所有其他缓动过渡都工作正常(悬停,缓入,取消悬停,缓出),但边界底部不会缓出。当您停止悬停时,它只会恢复正常而不会放松。

这是我为说明问题而制作的带有快速按钮的代码笔。

https://codepen.io/anon/pen/jwgpdv

这是我的 CSS:

.gbtn {
    background: #bba989;
    text-align: center;
    line-height: 150px;
    height: 150px;
    color: white;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 12px;
    display: inline-block;
    transition: all .25s ease;
    box-sizing: border-box;
    font-family: "montserrat", serif;
    padding: 0px 30px;
}

.gbtn:hover {
    background-color: #aa9470;
    border-bottom: 150px solid #242424;
}

【问题讨论】:

    标签: html css web css-transitions web-frontend


    【解决方案1】:

    悬停之前你没有定义边框,浏览器应该如何知道如何转出?

    添加这个:

    .gbtn {
     border-bottom: 0 solid #242424;
    }
    

    【讨论】:

    • 天哪,非常感谢!我不敢相信这是这么简单的事情。
    猜你喜欢
    • 1970-01-01
    • 2022-01-26
    • 2012-08-28
    • 2015-02-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-22
    相关资源
    最近更新 更多