css 文字左右抖动效果

html 复制代码
<template>
  <div class="box">
    <div class="shake shape">抖动特效交字11</div>
  </div>
</template>

<script setup></script>

<style scope>
.shape {
    margin: 50px;
    width: 200px;
    height: 50px;
    line-height: 50px;
    text-align: center;
    border: 1px solid black;
 }


.shake:hover {
    animation: shakeAnimal 800ms ease-in-out;
}
@keyframes shakeAnimal { /* 水平抖动,核心代码 */
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(+2px, 0, 0); }
    30%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(+4px, 0, 0); }
    50% { transform: translate3d(-4px, 0, 0); }
}

</style>
相关推荐
Dcc2 小时前
纯 css 实现前端主题切换+自定义方案
前端·css
华仔啊6 小时前
如何用 Vue3 打造高级音乐播放器?进度条+可视化效果,代码简洁可复用!
前端·css·vue.js
深蓝电商API1 天前
网页结构解析入门:HTML、CSS、JS 与爬虫的关系
javascript·css·html
Python私教1 天前
React 19 如何优雅整合 Ant Design v5 与 Tailwind CSS v4
前端·css·react.js
汤姆Tom1 天前
写这么多年CSS,都不知道什么是容器查询?
前端·css·面试
曦曜2921 天前
聊聊前端静态页面的开发
css·html
向葭奔赴♡2 天前
CSS是什么?—— 网页的“化妆师”
前端·css
银安2 天前
CSS排版布局篇(4):浮动(float)、定位(position) 、层叠(Stacking)
前端·css
wsWmsw2 天前
[译] 浏览器里的 Liquid Glass:利用 CSS 和 SVG 实现折射
前端·css·svg
银安2 天前
CSS排版布局篇(2):文档流(Normal Flow)
前端·css