【发布时间】:2019-11-12 00:05:24
【问题描述】:
如何根据这支笔 here 看着脉冲按钮使我的按钮在悬停时减小尺寸?
我的 CSS 如下所示:
.pulse {
margin:100px;
display: block;
width: 170px;
height: 22px;
background: #cca92c;
cursor: pointer;
box-shadow: 0 0 0 rgba(204,169,44, 0.4);
}
.pulse:hover {
animation: pulse 2s infinite;
}
@keyframes pulse {
0%{
width: 170px;
}
50%{
width: 120px;
}
}
HTML:
<button class="pulse">Button styling</button>
当我悬停时,宽度会减小,但效果与参考笔不同,参考笔会变小,如果这是正确的解释的话。
我的笔可以找到here
【问题讨论】:
-
你需要考虑
scale()而不是width -
笔使用
scale()创建脉冲效果,而不是widthcodepen.io/woolandcotton/pen/mBmLwq -
我好像没有看到代码,因为我没有登录。感谢支持
标签: html css button hover css-animations