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>
相关推荐
EatFan12 小时前
HTML前端利用flex解决input定位的问题
前端·css·html·css3
labixiong16 小时前
告别scroll 监听:CSS 滚动驱动动画,主线程堵死也仍跟手
前端·css·html
King of fraud1 天前
HTML 页面的 CSS 选择器详解
前端·css·html
我的div丢了肿么办1 天前
grid布局justify-items和align-items、justify-content和align-content
前端·css
BillKu2 天前
全局样式变量:CSS 自定义属性(--border-color)和SCSS 变量($border-color)的说明
javascript·css·scss
兜里只有三分钱~2 天前
翻卡_3D 的仪式感,和三个让它穿帮的写法
javascript·css·3d
Beyond_System|系统之外2 天前
一个网页如何同时适配投影仪、1366×768 和 1920×1080?我重新理解了“自适应布局”
开发语言·css·html
Claire_882 天前
从零搭建网页:我用AI生成HTML/CSS/JS的实践与工具整理
css·人工智能·html
平头哥~2 天前
Day 21 | animation 与 keyframes:把动画从 A 到 B 变成多点编排
前端·css·css3·css学习
里欧跑得慢3 天前
Flutter主题与样式详解
前端·css·flutter·web