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>
相关推荐
志尊宝2 小时前
AI原生前端开发(043):AI辅助的样式生成(Tailwind CSS)
前端·css·ai-native
java1234_小锋1 天前
【技术专题】CSS3 网页技术 - CSS3 布局进阶
前端·css·css3
java1234_小锋1 天前
【技术专题】CSS3 网页技术 - CSS3 视觉增强
前端·css·css3
晓得迷路了1 天前
栗子前端技术周刊第 152 期 - Rspack 2.3、TypeScript 7.1 Beta、Bun 1.4.4...
前端·javascript·css
普通人61 天前
CSS-box-sizing-使用指南
开发语言·前端·css·1024程序员节
前端架构师-老李1 天前
HTML与CSS基础第七课—HTML 中的a标签(跳转链接)
前端·css·html
溪语流沙2 天前
【每天一个CSS | Day41】开关三连:一套状态机,三种视觉翻译
前端·css·html5·每日一练·按钮
变与不变8062 天前
css定位布局精讲
前端·css
前端架构师-老李3 天前
HTML与CSS基础第五课—HTML的空格、换行、横线相关知识
前端·css·html
echome8883 天前
CSS 布局:Flex 和 Grid 怎么选,附常见坑
前端·css·html