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>
相关推荐
三天不学习13 小时前
Tailwind CSS 快速入门(2026 版):从 v4 零配置上手,到「该不该用、怎么用好」的选型实战
前端·css·tailwind
htzyl20614 小时前
前端阶梯——第九章、颜色、文本与背景
前端·css
htzyl20614 小时前
前端阶梯——第八章、CSS入门与选择器
前端·css
传人2 天前
页面中心圆圈放大效果如何写
前端·css
被摘下的星星2 天前
CSS 基础说明
前端·css
传人once3 天前
网页文字滚动效果如何做
前端·css·html·jquery·html5
乌暮3 天前
拆解网页的底层逻辑:用费曼学习法讲透 HTML 与 CSS
前端·css·学习·html
传人once3 天前
多图片上传预览功能如何写
前端·css·html·jquery·html5
传人once4 天前
悬停旋转放大和位移效果如何写
javascript·css·动画
听风3474 天前
windplay网页创意实验场
css·html·创意·website·windplay