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>
相关推荐
念念不忘 必有回响15 小时前
前端判断文本是否溢出:单行与多行场景的完整解析
前端·javascript·css·vue.js
@菜菜_达16 小时前
CSS是什么?
前端·css
Amumu1213817 小时前
CSS基础选择器
前端·css
陆枫Larry21 小时前
CSS 踩坑笔记:为什么列表底部的 margin-bottom 总是“失效”?
css
陆枫Larry21 小时前
深入浅出:CSS 中的“隐形结界”——BFC 详解
前端·css
coding随想1 天前
深入Modernizr源码:揭秘CSS伪类检测的底层逻辑
前端·css
程序员林北北1 天前
【前端进阶之旅】50 道前端超难面试题(2026 最新版)|覆盖 HTML/CSS/JS/Vue/React/TS/ 工程化 / 网络 / 跨端
前端·javascript·css·vue.js·html
Amumu121382 天前
CSS简介
前端·css
温轻舟2 天前
前端可视化大屏【附源码】
前端·javascript·css·html·可视化·可视化大屏·温轻舟
糖糖TANG2 天前
学成在线 案例练习
前端·css