倒计时动效

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;
  }
}
相关推荐
java1234_小锋10 小时前
【技术专题】HTML5 网页技术 - HTML5 SVG
前端·html·html5
燕落南枝1 天前
CSS 学习:类型选择器与 AI 注释实战
css·人工智能·学习
燕落南枝1 天前
CSS 类选择器详解:从入门到实战
前端·css
iCxhust1 天前
模型:500kW飞轮 10kV输电线路 油田抽油机 同时考虑无功补偿 统计:全年节电量 结果56万度电
前端·css·css3·电力·飞轮
燕落南枝2 天前
CSS 后代选择器与子代选择器:从入门到实战
前端·css
Data_Journal2 天前
如何使用 Python 解析 HTML
python·html
java1234_小锋2 天前
【技术专题】HTML5 网页技术 - HTML5 Canvas 基础以及动画入门
前端·html·html5
keyipatience2 天前
TypeScript学习(1)
前端·javascript·学习·typescript·html·css3
java1234_小锋2 天前
【技术专题】HTML5 网页技术 - HTML5 语义化标签
前端·html·html5
asdzx672 天前
C# 将 HTML 转换为 PDF:基于 Chrome 的转换方案
pdf·c#·html