gpt4 book ai didi

css - 按钮悬停效果down-top变色

转载 作者:太空宇宙 更新时间:2023-11-03 22:34:21 24 4
gpt4 key购买 nike

如何将此按钮的悬停效果从当前的自上而下反转为自下而上?

.btn-1 {
position: relative;
border-width: 2px;
border-color: #4285f4;
color: #4285f4;
background-color: transparent;
}


.slide-btn, .slide-btn::after {
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
}

.slide-btn::before, .slide-btn::after {
background: #4285f4;
content: '';
position: absolute;
z-index: -1;
}

.btn-1::after {
height: 0;
left: 0;
top: 0;
width: 100%;
}

.btn-1:hover:after {
height: 100%;
}
  <button class="btn-1 slide-btn">Button 1</button>

玩了很长时间,例如更改为 .btn-1::after { height: 100%; } 和 .btn-1::after { height:0; } ...这给了我向下的效果,但颜色相反。

最佳答案

在 .btn-1::after 中从上到下更改 https://jsfiddle.net/rp042h6j/

.btn-1::after {
height: 0;
left: 0;
bottom: 0;
width: 100%;
}

关于css - 按钮悬停效果down-top变色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47212105/

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