纯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>
相关推荐
cndes11 分钟前
给Miniconda换源,让包下载更迅速
开发语言·python
Metaphor69231 分钟前
使用 Python 添加、隐藏和删除 PDF 图层
python·pdf·图层
丨白色风车丨35 分钟前
【Python 计算机视觉】基于 Dlib+OpenCV 实现实时人眼疲劳检测(闭眼预警)
python·opencv·计算机视觉
嘘嘘出差1 小时前
Python 爬虫入门实战:爬取豆瓣电影 Top 250
开发语言·爬虫·python
爱写代码的倒霉蛋1 小时前
实现协程的三种方式
开发语言·python
崖边看雾2 小时前
记录Python学习——第一章环境安装下载(Windows)
windows·python·学习·pycharm
用户298698530142 小时前
Python 实现 Excel 到 ODS、XPS、PostScript 及 PDF/A-1b 的格式转换
后端·python·excel
本地化文档3 小时前
xlwings-docs-l10n
python·github·excel·gitcode·sphinx
梅雅达编程笔记3 小时前
零基础学 Python 第7章 | 字典 dict:键值对存储
开发语言·python·beautifulsoup·numpy·pandas