倒计时动效

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;
  }
}
相关推荐
幻影星空VR元宇宙2 小时前
飞行影院设备价格解析及性价比分析
css·百慕大冒险·幻影星空
Channing Lewis6 小时前
Python读取excel转成html,并且复制excel中单元格的颜色(字体或填充)
python·html·excel
cz追天之路7 小时前
华为机考 ------ 识别有效的IP地址和掩码并进行分类统计
javascript·华为·typescript·node.js·ecmascript·less·css3
0思必得010 小时前
[Web自动化] Requests模块基本使用
运维·前端·python·自动化·html·web自动化
代码游侠11 小时前
学习笔记——HTML网页开发基础
运维·服务器·开发语言·笔记·学习·html
@菜菜_达13 小时前
前端 HTML 入门(标签)
前端·html
霍理迪13 小时前
CSS布局方式——定位
前端·css
网络风云14 小时前
HTML 模块化方案
前端·html
灯把黑夜烧了一个洞14 小时前
2026年跨年倒计时网页版
javascript·css·html·2026跨年代码·新年代码
铅笔侠_小龙虾14 小时前
html+css 实现键盘
前端·css·html