【问题标题】:Border thickness transition边框粗细过渡
【发布时间】:2013-02-28 11:34:15
【问题描述】:

有没有办法在 2 个边框粗细之间缓入?

我的代码:

nav a {
border-bottom: 1px solid #AADA4B;
}


nav a:hover {
border-bottom: 3px solid #AADA4B;
}

非常感谢您的帮助。 山姆。

【问题讨论】:

    标签: css css-transitions


    【解决方案1】:

    当然,只需在 a 元素上转换 border 或 border-width:

    nav a {
    /* -moz-, -o-, -webkit- prefixes omitted for brevity */
    transition: border-width 0.1s ease-in-out;
    border-bottom: 1px solid #AADA4B;
    }
    

    【讨论】:

    • 如果边框颜色没有改变,我也建议在悬停时这样做:nav a:hover { border-bottom-width: 3px; }。像这样维护代码更容易。
    猜你喜欢
    • 1970-01-01
    • 2015-10-10
    • 1970-01-01
    • 2020-02-08
    • 1970-01-01
    • 2014-07-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多