纯CSS实现卡片欢动效果

编写CSS样式

css 复制代码
@keyframes cardShake {
  0% { transform: translateX(-2px); }
  25% { transform: translateX(2px); }
  50% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
  100% { transform: translateX(-2px); }
}
 
.card {
  animation: cardShake 0.5s; /* 抖动的持续时间 */
  animation-iteration-count: infinite; /* 动画重复次数 */
}

HTML中引用class

html 复制代码
<div class="card">卡片内容</div>
相关推荐
free-elcmacom10 小时前
深度学习<4>高效模型架构与优化器的“效率革命”
人工智能·python·深度学习·机器学习·架构
liliangcsdn10 小时前
python模拟beam search优化LLM输出过程
人工智能·python
王琦031811 小时前
Python 函数详解
开发语言·python
胡伯来了11 小时前
13. Python打包工具- setuptools
开发语言·python
小鸡吃米…11 小时前
Python 中的多层继承
开发语言·python
中國移动丶移不动12 小时前
Python MySQL 数据库操作完整示例
数据库·python·mysql
落叶,听雪12 小时前
AI建站推荐
大数据·人工智能·python
ZAz_12 小时前
DAY 45 预训练模型
python
呆萌很12 小时前
python 项目迁移
python
清水白石00812 小时前
《requests vs httpx:Python 网络请求库的全面对比与实战指南》
网络·python·httpx