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>
相关推荐
前端架构师-老李1 小时前
HTML与CSS基础第二课—初识HTML
前端·css·html
java1234_小锋2 小时前
【技术专题】CSS3 网页技术 - CSS3 单位、颜色、字体与文本
前端·css·css3
CappuccinoRose2 小时前
拖拽交互体系
前端·javascript·css·html·交互·1024程序员节
神膘护体小月半13 小时前
flex 布局的 order 属性
前端·css
java1234_小锋14 小时前
【技术专题】CSS3 网页技术 - CSS3 优先级
前端·css·css3
绝世唐门三哥15 小时前
CSS 换行三剑客:overflow-wrap、word-break 与 white-space 完全指南
前端·css
易朵朵16 小时前
Z-index
css
CodeMi17 小时前
2026 CSS 接管了这些 JS 的活:6 个 Baseline 特性的落地取舍
javascript·css
gCode Teacher 格码致知1 天前
前端教学8:提高 CSS 选择器的优先级,有哪些方法?
前端·css·html5
燕落南枝2 天前
CSS 表单选择器与伪元素选择器详解
前端·css