div+css实现2024新年快乐文字伸缩动画效果代码

代码语言:html

所属分类:布局界面

代码描述:div+css实现2024新年快乐文字伸缩动画效果代码

代码标签: div css 2024 新年 快乐 文字 伸缩 动画

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">
<style>
    @import url("https://fonts.googleapis.com/css2?family=Foldit:wght@300..700&display=swap");
@font-palette-values --color {
  font-family: "Foldit";
  override-colors: 0 #ffe14d, 1 #ff974d, 2 #fde04e, 3 #fde04e;
}
body {
  padding: 2rem;
  min-block-size: 100vb;
  display: grid;
  place-content: center;
  box-sizing: border-box;
  line-height: 1.5;
  font-size: 1.4rem;
  text-align: center;
  font-family: "Foldit", sans-serif;
  background: linear-gradient(120deg, #000933, #cc0000);
  color: #fde04e;
  font-variation-settings: "wght" 300;
  transition: all 0.2s cubic-bezier(0.83, 0, 0.17, 1);
  font-palette: --color;
}

.year,
.message {
  margin: 0;
  line-height: 1;
}

.year {
  margin-block-start: -2rem;
  font-size: 15rem;
}

.message {
  margin-block-start: -1rem;
  font-size: 5rem;
}

.year span,
.message span {
  animation-name: pulse;
  animation-duration: 10s;
  animation-iteration-count: infinite;
  animation-direction: alternate;
}

.year :nth-child(2n),
.message :nth-child(2n) {
  animation-direction: alternate-reverse;
}

.year :nth-child(3n),
.message :nth-child(3n) {
  animation-name: pulse-alt;
}

.year :nth-child(4n),
.message :nth-child(4n) {
  animation-direction: alternate-reverse;
  animation-name: pulse-alt;
}

.message span {
  animation-duration: 5s;
}

footer {
  font-size: 1.5rem;
  font-family: sans-serif;
  position: absolute;
  inset-block-end: 2rem;
  inset-inline-end: 2rem;
}

footer a {
  color: #fff;
}

@keyframes pulse {
  0% {
    .........完整代码请登录后点击上方下载按钮下载查看

网友评论0