小编Pen*_*lse的帖子

CSS动画到图像的脉冲部分

我在一个简单的图像上使用 CSS 动画。
我希望脉冲动画仅针对图像的一部分。
我如何制作脉冲动画,以便只有文本“Trello”改变不透明度?

这是我的代码:

.element {
  /*animation-delay: 2s;*/
  animation: pulse 3s infinite;
  margin: 0 auto;
  display: table;
  margin-top: 50px;
  animation-direction: alternate;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0.3;
  }
}

html,
body {
  height: 100%;
  background-color: #e74c3c;
}
Run Code Online (Sandbox Code Playgroud)
<img src="https://d78fikflryjgj.cloudfront.net/images/50b4ebc64391dc394a38e73aed57f0e2/header-logo.png" alt="" class="element" />
Run Code Online (Sandbox Code Playgroud)

在 CodePen 上查看

html css css-animations

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

css ×1

css-animations ×1

html ×1