gpt4 book ai didi

css - 按钮周围的脉冲效果 CSS 不起作用

转载 作者:行者123 更新时间:2023-11-28 02:31:02 25 4
gpt4 key购买 nike

我正在尝试围绕此按钮创建脉冲效果。不幸的是它不工作......我找不到错误。

#pulse {
width: 50px;
height: 100%;
}

#show {
float: left;
margin-top: -200px;
margin-left: 10px;
border: none;
height: 40px;
width: 40px;
box-shadow: 0 0 0 0 rgba(232, 76, 61, 0.7);
border-radius: 50%;
background: none;
cursor: pointer;
background-image: url('bilder/showleftside.svg');
background-repeat: no-repeat;
background-size: cover;
-webkit-animation: pulse 1.25s infinite cubic-bezier(0.66, 0, 0, 1);
-moz-animation: pulse 1.25s infinite cubic-bezier(0.66, 0, 0, 1);
-ms-animation: pulse 1.25s infinite cubic-bezier(0.66, 0, 0, 1);
animation: pulse 1.25s infinite cubic-bezier(0.66, 0, 0, 1);
}

@keyframes pulse {
0% {
transform: scale(1, 1);
}
50% {
opacity: 0.3;
}
100% {
transform: scale(1.5);
opacity: 0;
}
}
<div id="pulse">
<button id="show" type="button" onclick=""></button>
</div>

最佳答案

您定义了一个名为pulse 的动画。您的代码中缺少此脉冲动画应该执行的操作。添加关键帧来定义您的动画。

https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes

#pulse {
width: 50px;
height: 100%;
}



#show {
float: left;
margin: 20px;

border: 1px solid #ddd;
height: 40px;
width: 40px;
box-shadow: 0 0 0 0 rgba(232, 76, 61, 0.7);
border-radius: 50%;
background: none;
cursor: pointer;

background-image: url('bilder/showleftside.svg');
background-repeat: no-repeat;
background-size: cover;

-webkit-animation: pulse 1.25s infinite cubic-bezier(0.66, 0, 0, 1);
-moz-animation: pulse 1.25s infinite cubic-bezier(0.66, 0, 0, 1);
-ms-animation: pulse 1.25s infinite cubic-bezier(0.66, 0, 0, 1);
animation: pulse 1.25s infinite cubic-bezier(0.66, 0, 0, 1);
}

@keyframes pulse {
0% {
transform: scale(1);
}
50% {
transform: scale(1.2);
}
100% {
transform: scale(1);
}
}
<div id="pulse">
<button id="show" type="button">X</button>
</div>

关于css - 按钮周围的脉冲效果 CSS 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47701838/

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