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>
相关推荐
前端Hardy3 小时前
HTML&CSS:高颜值产品卡片页面,支持主题切换
css·html
Never_Satisfied6 小时前
在HTML & CSS中,nth-child、nth-of-type详解
前端·css·html
光影少年6 小时前
前端css如何实现水平垂直居中?
前端·javascript·css
Purgatory00110 小时前
CSS 访问服务器
服务器·前端·css
henry10101010 小时前
DeepSeek生成的HTML5小游戏 -- 黑8台球
前端·javascript·css·游戏·html
不会敲代码11 天前
从原子CSS到TailwindCSS:现代前端样式解决方案全解析
前端·css·react.js
小九今天不码代码1 天前
CSS 九宫格拼图动画效果实现与原理解析
css·css3·动画效果·css动画·grid布局·css技巧·九宫格布局
_Eleven1 天前
前端布局指南
前端·css
Amumu121381 天前
CSS进阶导读
前端·css
Web_Lys1 天前
css设置滚动条样式不生效【antDesign UI Table滚动条样式无法自定义 解决方案】
前端·css