倒计时动效

1. 效果

2. html

html 复制代码
<div class="count">
  <span>3</span>
  <span>2</span>
  <span>1</span>
</div>

3. css

css 复制代码
body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.count {
  position: relative;
  width: 180px;
  height: 180px;
  font-family: Consolas, Monaco, monospace;
  font-size: 100px;
  border: 5px solid #333333;
  border-radius: 50%;
  overflow: hidden;
}

.count span {
  display: block;
  width: 100%;
  height: 180px;
  line-height: 180px;
  text-align: center;
  animation: count 5s steps(5, end) forwards, shark 1s .8s 5;
}

.count::after {
  content: 'Go!';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  font-size: 70px !important;
  animation: go .5s 3s forwards;
}

@keyframes count {
  to {
    transform: translateY(calc(-5 * 180px));
  }
}

@keyframes shark {
  0% {
    opacity: 1;
  }

  20% {
    opacity: 0;
    font-size: 40px;
  }
}

@keyframes go {
  to {
    font-size: 70px;
    opacity: 1;
  }
}
相关推荐
CappuccinoRose8 小时前
HTML语法学习文档(五)
前端·html·html5·表单
a11177619 小时前
优雅简历(html开源)
前端·开源·html
明月_清风20 小时前
HTML 早已不是标签了,它现在是系统级接口:这 9 个 API 直接干翻常用 JS 库
前端·html
岱宗夫up20 小时前
【前端基础】HTML + CSS + JavaScript 快速入门
前端·css·html
~央千澈~21 小时前
2026 年 2 月 17 日(农历大年初一),优雅草科技正式启用最新版官网·并且依然开源代码
html
CappuccinoRose1 天前
CSS 语法学习文档(十九)
前端·css·属性·flex·grid·学习资源·格式化上下文
前端 贾公子1 天前
深入理解 Vue3 的 v-model 及自定义指令的实现原理(下)
前端·html
qq_24218863322 天前
3389端口内网转发概述
前端·经验分享·html
Never_Satisfied2 天前
在JavaScript / HTML中,数组查找第一个符合要求元素
开发语言·javascript·html
henry1010102 天前
DeepSeek生成的网页小游戏 - 迷你高尔夫
前端·javascript·游戏·html