【问题标题】:Why is this button not animating?为什么这个按钮没有动画?
【发布时间】:2022-01-31 21:51:22
【问题描述】:

我从教程中复制了这段代码,动画效果很好:

该按钮只是显示一个静态渐变。另外,我很难将文本垂直对齐到按钮的中心。例如。 top: 10px 实际上是按下按钮下方的文本。

.cta-button {
  height: 32px;
  border: 0;
  padding: 0px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  color: white;
  text-justify: center;
}

.connect-wallet-button {
  background-image: linear-gradient( to right, #ff8177 0%, #ff867a 0%, #000 21%, #f99185 52%, #cf556c 78%, #b12a5b 100%);
  background-size: 200% 200%;
  animation: gradient-animation 4s ease infinite;
}
<div class="connect-wallet-container">
  <button class="cta-button connect-wallet-button">
    Connect Wallet
  </button>
</div>

【问题讨论】:

    标签: html css css-animations


    【解决方案1】:

    你缺少关键帧,动画本身 @keyframes gradient-animation https://www.w3schools.com/css/tryit.asp?filename=trycss3_animation1

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-10-07
      • 1970-01-01
      • 2019-01-21
      • 1970-01-01
      • 1970-01-01
      • 2018-07-09
      • 1970-01-01
      相关资源
      最近更新 更多