Pular para o conteúdo principal

Tutorial: Criando Árvore de Natal Animada com CSS

Árvore de Natal Animada com CSS


Neste tutorial, vamos aprender a criar uma Árvore de Natal Animada utilizando apenas HTML e CSS. O projeto é simples e visualmente impactante, envolvendo um design geométrico e animações suaves.

Veja a Árvore de Natal Animada em funcionamento neste link. Árvore de Natal Animada.

Veja o vídeo no YouTube:

Pré-requisitos

  • Conhecimentos básicos de HTML e CSS.
  • Um editor de código, como VS Code ou Sublime Text.
  • Um navegador para visualizar o resultado.

Estrutura do Projeto

A estrutura do projeto é simples:

/meu-projeto
|-- index.html
|-- style.css

1. Criando o Arquivo HTML

Crie um arquivo chamado index.html e adicione o seguinte código:



<!DOCTYPE html>

<html lang="pt-br">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Árvore de Natal com CSS</title>

    <link rel="stylesheet" type="text/css" media="screen" href="style.css">

</head>

<body>

    

<ul>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

  </ul>

  <ul>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

    <li></li>

  </ul>

</body>

</html>

2. Estilizando com CSS

Crie um arquivo chamado style.css e insira o seguinte código:



body {

    background: #323133;

}

body ul {

    padding: 0;

}

body ul li {

    list-style: none;

}

body ul:nth-child(1) {

    position: absolute;

    top: calc(20vh - 1.6rem);

    left: 50%;

    width: 1rem;

    height: 1rem;

    border-radius: 100%;

    transform: translate(-50%, -50%);

}

body ul:nth-child(1) li {

    position: absolute;

    width: 0;

    height: 0;

    border-width: 0 0.5rem 1rem 0.5rem;

    border-style: solid;

    border-color: transparent;

    border-bottom-color: #FFCE54;

    transform-origin: 0.5rem 1rem;

}

body ul:nth-child(1) li:nth-child(0) {

    transform: rotate(0deg);

}

body ul:nth-child(1) li:nth-child(1) {

    transform: rotate(72deg);

}

body ul:nth-child(1) li:nth-child(2) {

    transform: rotate(144deg);

}

body ul:nth-child(1) li:nth-child(3) {

    transform: rotate(216deg);

}

body ul:nth-child(1) li:nth-child(4) {

    transform: rotate(288deg);

}

body ul:nth-child(2) {

    padding: 0;

}

body ul:nth-child(2) li {

    position: absolute;

    top: 20vh;

    right: 50%;

    width: 0.0625rem;

    background: linear-gradient(rgba(46, 204, 113, 0), rgba(46, 204, 113, 0.25));

    list-style: none;

    transform-origin: 50% 0;

    animation: swing 4s ease-in-out infinite;

}

body ul:nth-child(2) li:nth-child(1) {

    height: 2.2727272727vh;

    -webkit-animation-delay: -0.21875s;

    animation-delay: -0.21875s;

}

body ul:nth-child(2) li:nth-child(2) {

    height: 2.7272727273vh;

    -webkit-animation-delay: -0.4375s;

    animation-delay: -0.4375s;

}

body ul:nth-child(2) li:nth-child(3) {

    height: 3.1818181818vh;

    -webkit-animation-delay: -0.65625s;

    animation-delay: -0.65625s;

}

body ul:nth-child(2) li:nth-child(4) {

    height: 3.6363636364vh;

    -webkit-animation-delay: -0.875s;

    animation-delay: -0.875s;

}

body ul:nth-child(2) li:nth-child(5) {

    height: 4.0909090909vh;

    -webkit-animation-delay: -1.09375s;

    animation-delay: -1.09375s;

}

body ul:nth-child(2) li:nth-child(6) {

    height: 4.5454545455vh;

    -webkit-animation-delay: -1.3125s;

    animation-delay: -1.3125s;

}

body ul:nth-child(2) li:nth-child(7) {

    height: 5vh;

    -webkit-animation-delay: -1.53125s;

    animation-delay: -1.53125s;

}

body ul:nth-child(2) li:nth-child(8) {

    height: 5.4545454545vh;

    -webkit-animation-delay: -1.75s;

    animation-delay: -1.75s;

}

body ul:nth-child(2) li:nth-child(9) {

    height: 5.9090909091vh;

    -webkit-animation-delay: -1.96875s;

    animation-delay: -1.96875s;

}

body ul:nth-child(2) li:nth-child(10) {

    height: 6.3636363636vh;

    -webkit-animation-delay: -2.1875s;

            animation-delay: -2.1875s;

  }

  body ul:nth-child(2) li:nth-child(11) {

    height: 6.8181818182vh;

    -webkit-animation-delay: -2.40625s;

            animation-delay: -2.40625s;

  }

  body ul:nth-child(2) li:nth-child(12) {

    height: 7.2727272727vh;

    -webkit-animation-delay: -2.625s;

            animation-delay: -2.625s;

  }

  body ul:nth-child(2) li:nth-child(13) {

    height: 7.7272727273vh;

    -webkit-animation-delay: -2.84375s;

            animation-delay: -2.84375s;

  }

  body ul:nth-child(2) li:nth-child(14) {

    height: 8.1818181818vh;

    -webkit-animation-delay: -3.0625s;

            animation-delay: -3.0625s;

  }

  body ul:nth-child(2) li:nth-child(15) {

    height: 8.6363636364vh;

    -webkit-animation-delay: -3.28125s;

            animation-delay: -3.28125s;

  }

  body ul:nth-child(2) li:nth-child(16) {

    height: 9.0909090909vh;

    -webkit-animation-delay: -3.5s;

            animation-delay: -3.5s;

  }

  body ul:nth-child(2) li:nth-child(17) {

    height: 9.5454545455vh;

    -webkit-animation-delay: -3.71875s;

            animation-delay: -3.71875s;

  }

  

  body ul:nth-child(2) li:nth-child(18) {

    height: 10vh;

    -webkit-animation-delay: -3.9375s;

            animation-delay: -3.9375s;

  }

  body ul:nth-child(2) li:nth-child(19) {

    height: 10.4545454545vh;

    -webkit-animation-delay: -4.15625s;

            animation-delay: -4.15625s;

  }

  body ul:nth-child(2) li:nth-child(20) {

    height: 10.9090909091vh;

    -webkit-animation-delay: -4.375s;

            animation-delay: -4.375s;

  }

  body ul:nth-child(2) li:nth-child(21) {

    height: 11.3636363636vh;

    -webkit-animation-delay: -4.59375s;

            animation-delay: -4.59375s;

  }

  body ul:nth-child(2) li:nth-child(22) {

    height: 11.8181818182vh;

    -webkit-animation-delay: -4.8125s;

            animation-delay: -4.8125s;

  }

  body ul:nth-child(2) li:nth-child(23) {

    height: 12.2727272727vh;

    -webkit-animation-delay: -5.03125s;

            animation-delay: -5.03125s;

  }

  body ul:nth-child(2) li:nth-child(24) {

    height: 12.7272727273vh;

    -webkit-animation-delay: -5.25s;

            animation-delay: -5.25s;

  }

  body ul:nth-child(2) li:nth-child(25) {

    height: 13.1818181818vh;

    -webkit-animation-delay: -5.46875s;

            animation-delay: -5.46875s;

  }

  body ul:nth-child(2) li:nth-child(26) {

    height: 13.6363636364vh;

    -webkit-animation-delay: -5.6875s;

            animation-delay: -5.6875s;

  }

  body ul:nth-child(2) li:nth-child(27) {

    height: 14.0909090909vh;

    -webkit-animation-delay: -5.90625s;

            animation-delay: -5.90625s;

  }

  body ul:nth-child(2) li:nth-child(28) {

    height: 14.5454545455vh;

    -webkit-animation-delay: -6.125s;

            animation-delay: -6.125s;

  }

  body ul:nth-child(2) li:nth-child(29) {

    height: 15vh;

    -webkit-animation-delay: -6.34375s;

            animation-delay: -6.34375s;

  }

  body ul:nth-child(2) li:nth-child(30) {

    height: 15.4545454545vh;

    -webkit-animation-delay: -6.5625s;

            animation-delay: -6.5625s;

  }

  body ul:nth-child(2) li:nth-child(31) {

    height: 15.9090909091vh;

    -webkit-animation-delay: -6.78125s;

            animation-delay: -6.78125s;

  }

  body ul:nth-child(2) li:nth-child(32) {

    height: 16.3636363636vh;

    -webkit-animation-delay: -7s;

            animation-delay: -7s;

  }

  body ul:nth-child(2) li:nth-child(33) {

    height: 16.8181818182vh;

    -webkit-animation-delay: -7.21875s;

            animation-delay: -7.21875s;

  }

  body ul:nth-child(2) li:nth-child(34) {

    height: 17.2727272727vh;

    -webkit-animation-delay: -7.4375s;

            animation-delay: -7.4375s;

  }

  body ul:nth-child(2) li:nth-child(35) {

    height: 17.7272727273vh;

    -webkit-animation-delay: -7.65625s;

            animation-delay: -7.65625s;

  }

  body ul:nth-child(2) li:nth-child(36) {

    height: 18.1818181818vh;

    -webkit-animation-delay: -7.875s;

            animation-delay: -7.875s;

  }

  body ul:nth-child(2) li:nth-child(37) {

    height: 18.6363636364vh;

    -webkit-animation-delay: -8.09375s;

            animation-delay: -8.09375s;

  }

  body ul:nth-child(2) li:nth-child(38) {

    height: 19.0909090909vh;

    -webkit-animation-delay: -8.3125s;

            animation-delay: -8.3125s;

  }

  body ul:nth-child(2) li:nth-child(39) {

    height: 19.5454545455vh;

    -webkit-animation-delay: -8.53125s;

            animation-delay: -8.53125s;

  }

  body ul:nth-child(2) li:nth-child(40) {

    height: 20vh;

    -webkit-animation-delay: -8.75s;

            animation-delay: -8.75s;

  }

  body ul:nth-child(2) li:nth-child(41) {

    height: 20.4545454545vh;

    -webkit-animation-delay: -8.96875s;

            animation-delay: -8.96875s;

  }

  body ul:nth-child(2) li:nth-child(42) {

    height: 20.9090909091vh;

    -webkit-animation-delay: -9.1875s;

            animation-delay: -9.1875s;

  }

  body ul:nth-child(2) li:nth-child(43) {

    height: 21.3636363636vh;

    -webkit-animation-delay: -9.40625s;

            animation-delay: -9.40625s;

  }

  body ul:nth-child(2) li:nth-child(44) {

    height: 21.8181818182vh;

    -webkit-animation-delay: -9.625s;

            animation-delay: -9.625s;

  }

  body ul:nth-child(2) li:nth-child(45) {

    height: 22.2727272727vh;

    -webkit-animation-delay: -9.84375s;

            animation-delay: -9.84375s;

  }

  body ul:nth-child(2) li:nth-child(46) {

    height: 22.7272727273vh;

    -webkit-animation-delay: -10.0625s;

            animation-delay: -10.0625s;

  }

  body ul:nth-child(2) li:nth-child(47) {

    height: 23.1818181818vh;

    -webkit-animation-delay: -10.28125s;

            animation-delay: -10.28125s;

  }

  body ul:nth-child(2) li:nth-child(48) {

    height: 23.6363636364vh;

    -webkit-animation-delay: -10.5s;

            animation-delay: -10.5s;

  }

  body ul:nth-child(2) li:nth-child(49) {

    height: 24.0909090909vh;

    -webkit-animation-delay: -10.71875s;

            animation-delay: -10.71875s;

  }

  body ul:nth-child(2) li:nth-child(50) {

    height: 24.5454545455vh;

    -webkit-animation-delay: -10.9375s;

            animation-delay: -10.9375s;

  }

  body ul:nth-child(2) li:nth-child(51) {

    height: 25vh;

    -webkit-animation-delay: -11.15625s;

            animation-delay: -11.15625s;

  }

  body ul:nth-child(2) li:nth-child(52) {

    height: 25.4545454545vh;

    -webkit-animation-delay: -11.375s;

            animation-delay: -11.375s;

  }

  body ul:nth-child(2) li:nth-child(53) {

    height: 25.9090909091vh;

    -webkit-animation-delay: -11.59375s;

            animation-delay: -11.59375s;

  }

  body ul:nth-child(2) li:nth-child(54) {

    height: 26.3636363636vh;

    -webkit-animation-delay: -11.8125s;

            animation-delay: -11.8125s;

  }

  body ul:nth-child(2) li:nth-child(55) {

    height: 26.8181818182vh;

    -webkit-animation-delay: -12.03125s;

            animation-delay: -12.03125s;

  }

  body ul:nth-child(2) li:nth-child(56) {

    height: 27.2727272727vh;

    -webkit-animation-delay: -12.25s;

            animation-delay: -12.25s;

  }

  body ul:nth-child(2) li:nth-child(57) {

    height: 27.7272727273vh;

    -webkit-animation-delay: -12.46875s;

            animation-delay: -12.46875s;

  }

  body ul:nth-child(2) li:nth-child(58) {

    height: 28.1818181818vh;

    -webkit-animation-delay: -12.6875s;

            animation-delay: -12.6875s;

  }

  body ul:nth-child(2) li:nth-child(59) {

    height: 28.6363636364vh;

    -webkit-animation-delay: -12.90625s;

            animation-delay: -12.90625s;

  }

  body ul:nth-child(2) li:nth-child(60) {

    height: 29.0909090909vh;

    -webkit-animation-delay: -13.125s;

            animation-delay: -13.125s;

  }

  body ul:nth-child(2) li:nth-child(61) {

    height: 29.5454545455vh;

    -webkit-animation-delay: -13.34375s;

            animation-delay: -13.34375s;

  }

  body ul:nth-child(2) li:nth-child(62) {

    height: 30vh;

    -webkit-animation-delay: -13.5625s;

            animation-delay: -13.5625s;

  }

  body ul:nth-child(2) li:nth-child(63) {

    height: 30.4545454545vh;

    -webkit-animation-delay: -13.78125s;

            animation-delay: -13.78125s;

  }

  body ul:nth-child(2) li:nth-child(64) {

    height: 30.9090909091vh;

    -webkit-animation-delay: -14s;

            animation-delay: -14s;

  }

  body ul:nth-child(2) li:nth-child(65) {

    height: 31.3636363636vh;

    -webkit-animation-delay: -14.21875s;

            animation-delay: -14.21875s;

  }

  body ul:nth-child(2) li:nth-child(66) {

    height: 31.8181818182vh;

    -webkit-animation-delay: -14.4375s;

            animation-delay: -14.4375s;

  }

  body ul:nth-child(2) li:nth-child(67) {

    height: 32.2727272727vh;

    -webkit-animation-delay: -14.65625s;

            animation-delay: -14.65625s;

  }

  body ul:nth-child(2) li:nth-child(68) {

    height: 32.7272727273vh;

    -webkit-animation-delay: -14.875s;

            animation-delay: -14.875s;

  }

  body ul:nth-child(2) li:nth-child(69) {

    height: 33.1818181818vh;

    -webkit-animation-delay: -15.09375s;

            animation-delay: -15.09375s;

  }

  body ul:nth-child(2) li:nth-child(70) {

    height: 33.6363636364vh;

    -webkit-animation-delay: -15.3125s;

            animation-delay: -15.3125s;

  }

  body ul:nth-child(2) li:nth-child(71) {

    height: 34.0909090909vh;

    -webkit-animation-delay: -15.53125s;

            animation-delay: -15.53125s;

  }

  body ul:nth-child(2) li:nth-child(72) {

    height: 34.5454545455vh;

    -webkit-animation-delay: -15.75s;

            animation-delay: -15.75s;

  }

  body ul:nth-child(2) li:nth-child(73) {

    height: 35vh;

    -webkit-animation-delay: -15.96875s;

            animation-delay: -15.96875s;

  }

  body ul:nth-child(2) li:nth-child(74) {

    height: 35.4545454545vh;

    -webkit-animation-delay: -16.1875s;

            animation-delay: -16.1875s;

  }

  body ul:nth-child(2) li:nth-child(75) {

    height: 35.9090909091vh;

    -webkit-animation-delay: -16.40625s;

            animation-delay: -16.40625s;

  }

  body ul:nth-child(2) li:nth-child(76) {

    height: 36.3636363636vh;

    -webkit-animation-delay: -16.625s;

            animation-delay: -16.625s;

  }

  body ul:nth-child(2) li:nth-child(77) {

    height: 36.8181818182vh;

    -webkit-animation-delay: -16.84375s;

            animation-delay: -16.84375s;

  }

  body ul:nth-child(2) li:nth-child(78) {

    height: 37.2727272727vh;

    -webkit-animation-delay: -17.0625s;

            animation-delay: -17.0625s;

  }

  body ul:nth-child(2) li:nth-child(79) {

    height: 37.7272727273vh;

    -webkit-animation-delay: -17.28125s;

            animation-delay: -17.28125s;

  }

  body ul:nth-child(2) li:nth-child(80) {

    height: 38.1818181818vh;

    -webkit-animation-delay: -17.5s;

            animation-delay: -17.5s;

  }

  body ul:nth-child(2) li:nth-child(81) {

    height: 38.6363636364vh;

    -webkit-animation-delay: -17.71875s;

            animation-delay: -17.71875s;

  }

  body ul:nth-child(2) li:nth-child(82) {

    height: 39.0909090909vh;

    -webkit-animation-delay: -17.9375s;

            animation-delay: -17.9375s;

  }

  body ul:nth-child(2) li:nth-child(83) {

    height: 39.5454545455vh;

    -webkit-animation-delay: -18.15625s;

            animation-delay: -18.15625s;

  }

  body ul:nth-child(2) li:nth-child(84) {

    height: 40vh;

    -webkit-animation-delay: -18.375s;

            animation-delay: -18.375s;

  }

  body ul:nth-child(2) li:nth-child(85) {

    height: 40.4545454545vh;

    -webkit-animation-delay: -18.59375s;

            animation-delay: -18.59375s;

  }

  body ul:nth-child(2) li:nth-child(86) {

    height: 40.9090909091vh;

    -webkit-animation-delay: -18.8125s;

            animation-delay: -18.8125s;

  }

  body ul:nth-child(2) li:nth-child(87) {

    height: 41.3636363636vh;

    -webkit-animation-delay: -19.03125s;

            animation-delay: -19.03125s;

  }

  body ul:nth-child(2) li:nth-child(88) {

    height: 41.8181818182vh;

    -webkit-animation-delay: -19.25s;

            animation-delay: -19.25s;

  }

  body ul:nth-child(2) li:nth-child(89) {

    height: 42.2727272727vh;

    -webkit-animation-delay: -19.46875s;

            animation-delay: -19.46875s;

  }

  body ul:nth-child(2) li:nth-child(90) {

    height: 42.7272727273vh;

    -webkit-animation-delay: -19.6875s;

            animation-delay: -19.6875s;

  }

  body ul:nth-child(2) li:nth-child(91) {

    height: 43.1818181818vh;

    -webkit-animation-delay: -19.90625s;

            animation-delay: -19.90625s;

  }

  body ul:nth-child(2) li:nth-child(92) {

    height: 43.6363636364vh;

    -webkit-animation-delay: -20.125s;

            animation-delay: -20.125s;

  }

  body ul:nth-child(2) li:nth-child(93) {

    height: 44.0909090909vh;

    -webkit-animation-delay: -20.34375s;

            animation-delay: -20.34375s;

  }

  body ul:nth-child(2) li:nth-child(94) {

    height: 44.5454545455vh;

    -webkit-animation-delay: -20.5625s;

            animation-delay: -20.5625s;

  }

  body ul:nth-child(2) li:nth-child(95) {

    height: 45vh;

    -webkit-animation-delay: -20.78125s;

            animation-delay: -20.78125s;

  }

  body ul:nth-child(2) li:nth-child(96) {

    height: 45.4545454545vh;

    -webkit-animation-delay: -21s;

            animation-delay: -21s;

  }

  body ul:nth-child(2) li:nth-child(97) {

    height: 45.9090909091vh;

    -webkit-animation-delay: -21.21875s;

            animation-delay: -21.21875s;

  }

  body ul:nth-child(2) li:nth-child(98) {

    height: 46.3636363636vh;

    -webkit-animation-delay: -21.4375s;

            animation-delay: -21.4375s;

  }

  body ul:nth-child(2) li:nth-child(99) {

    height: 46.8181818182vh;

    -webkit-animation-delay: -21.65625s;

            animation-delay: -21.65625s;

  }

  body ul:nth-child(2) li:nth-child(100) {

    height: 47.2727272727vh;

    -webkit-animation-delay: -21.875s;

            animation-delay: -21.875s;

  }

  body ul:nth-child(2) li:nth-child(101) {

    height: 47.7272727273vh;

    -webkit-animation-delay: -22.09375s;

            animation-delay: -22.09375s;

  }

  body ul:nth-child(2) li:nth-child(102) {

    height: 48.1818181818vh;

    -webkit-animation-delay: -22.3125s;

            animation-delay: -22.3125s;

  }

  body ul:nth-child(2) li:nth-child(103) {

    height: 48.6363636364vh;

    -webkit-animation-delay: -22.53125s;

            animation-delay: -22.53125s;

  }

  body ul:nth-child(2) li:nth-child(104) {

    height: 49.0909090909vh;

    -webkit-animation-delay: -22.75s;

            animation-delay: -22.75s;

  }

  body ul:nth-child(2) li:nth-child(105) {

    height: 49.5454545455vh;

    -webkit-animation-delay: -22.96875s;

            animation-delay: -22.96875s;

  }

  body ul:nth-child(2) li:nth-child(106) {

    height: 50vh;

    -webkit-animation-delay: -23.1875s;

            animation-delay: -23.1875s;

  }

  body ul:nth-child(2) li:nth-child(107) {

    height: 50.4545454545vh;

    -webkit-animation-delay: -23.40625s;

            animation-delay: -23.40625s;

  }

  body ul:nth-child(2) li:nth-child(108) {

    height: 50.9090909091vh;

    -webkit-animation-delay: -23.625s;

            animation-delay: -23.625s;

  }

  body ul:nth-child(2) li:nth-child(109) {

    height: 51.3636363636vh;

    -webkit-animation-delay: -23.84375s;

            animation-delay: -23.84375s;

  }

  body ul:nth-child(2) li:nth-child(110) {

    height: 51.8181818182vh;

    -webkit-animation-delay: -24.0625s;

            animation-delay: -24.0625s;

  }

  body ul:nth-child(2) li:nth-child(111) {

    height: 52.2727272727vh;

    -webkit-animation-delay: -24.28125s;

            animation-delay: -24.28125s;

  }

  body ul:nth-child(2) li:nth-child(112) {

    height: 52.7272727273vh;

    -webkit-animation-delay: -24.5s;

            animation-delay: -24.5s;

  }

  body ul:nth-child(2) li:nth-child(113) {

    height: 53.1818181818vh;

    -webkit-animation-delay: -24.71875s;

            animation-delay: -24.71875s;

  }

  body ul:nth-child(2) li:nth-child(114) {

    height: 53.6363636364vh;

    -webkit-animation-delay: -24.9375s;

            animation-delay: -24.9375s;

  }

  body ul:nth-child(2) li:nth-child(115) {

    height: 54.0909090909vh;

    -webkit-animation-delay: -25.15625s;

            animation-delay: -25.15625s;

  }

  body ul:nth-child(2) li:nth-child(116) {

    height: 54.5454545455vh;

    -webkit-animation-delay: -25.375s;

            animation-delay: -25.375s;

  }

  body ul:nth-child(2) li:nth-child(117) {

    height: 55vh;

    -webkit-animation-delay: -25.59375s;

            animation-delay: -25.59375s;

  }

  body ul:nth-child(2) li:nth-child(118) {

    height: 55.4545454545vh;

    -webkit-animation-delay: -25.8125s;

            animation-delay: -25.8125s;

  }

  body ul:nth-child(2) li:nth-child(119) {

    height: 55.9090909091vh;

    -webkit-animation-delay: -26.03125s;

            animation-delay: -26.03125s;

  }

  body ul:nth-child(2) li:nth-child(120) {

    height: 56.3636363636vh;

    -webkit-animation-delay: -26.25s;

            animation-delay: -26.25s;

  }

  body ul:nth-child(2) li:nth-child(121) {

    height: 56.8181818182vh;

    -webkit-animation-delay: -26.46875s;

            animation-delay: -26.46875s;

  }

  body ul:nth-child(2) li:nth-child(122) {

    height: 57.2727272727vh;

    -webkit-animation-delay: -26.6875s;

            animation-delay: -26.6875s;

  }

  body ul:nth-child(2) li:nth-child(123) {

    height: 57.7272727273vh;

    -webkit-animation-delay: -26.90625s;

            animation-delay: -26.90625s;

  }

  body ul:nth-child(2) li:nth-child(124) {

    height: 58.1818181818vh;

    -webkit-animation-delay: -27.125s;

            animation-delay: -27.125s;

  }

  body ul:nth-child(2) li:nth-child(125) {

    height: 58.6363636364vh;

    -webkit-animation-delay: -27.34375s;

            animation-delay: -27.34375s;

  }

  body ul:nth-child(2) li:nth-child(126) {

    height: 59.0909090909vh;

    -webkit-animation-delay: -27.5625s;

            animation-delay: -27.5625s;

  }

  body ul:nth-child(2) li:nth-child(127) {

    height: 59.5454545455vh;

    -webkit-animation-delay: -27.78125s;

            animation-delay: -27.78125s;

  }

  body ul:nth-child(2) li:nth-child(128) {

    height: 60vh;

    -webkit-animation-delay: -28s;

            animation-delay: -28s;

  }

  body ul:nth-child(2) li:before {

    content: "";

    position: absolute;

    left: -1px;

    bottom: 1px;

    width: 3px;

    height: 3px;

  }

  body ul:nth-child(2) li:nth-child(4n):before {

    background: #D8334A;

  }

  body ul:nth-child(2) li:nth-child(4n+1):before {

    background: #FFCE54;

  }

  body ul:nth-child(2) li:nth-child(4n+2):before {

    background: #2ECC71;

  }

  body ul:nth-child(2) li:nth-child(4n+3):before {

    background: #5D9CEC;

  }

  @-webkit-keyframes swing {

    0%, 100% {

      transform: rotate(-30deg);

    }

    5%, 45% {

      opacity: 0.25;

    }

    50%, 100%, 0% {

      opacity: 1;

    }

    50% {

      transform: rotate(30deg);

    }

  }

  @keyframes swing {

    0%, 100% {

      transform: rotate(-30deg);

    }

    5%, 45% {

      opacity: 0.25;

    }

    50%, 100%, 0% {

      opacity: 1;

    }

    50% {

      transform: rotate(30deg);

    }

  }

        

3. Testando o Projeto

  1. Salve os arquivos.

  2. Abra o index.html no navegador.

  3. Você verá a Árvore Animada funcionando!

4. Personalizações

  • Cores: Mude as cores para criar designs únicos.
  • Animações: Ajuste o @keyframes para criar variações de movimento.
  • Novos elementos: Adicione mais <li> ou outros elementos para aumentar a complexidade.

Conclusão

Você agora tem uma Árvore de Natal Animada com HTML e CSS.

Se preferir os códigos estão no meu Repositório no GitHub.

Aproveite e compartilhe o espírito natalino!

Boas festas e bons códigos! 🎅🎄

Comentários

Mais vistas

Autocode - Significado e Funcionalidade

O Que é Autocode? O Autocode foi uma das primeiras linguagens de programação de computador, desenvolvida em 1952 por Alick Glennie para o computador Mark 1 na Universidade

Semáforo - HTML, CSS e JavaScript - Tutorial

Semáforo Funcional: Aprenda a criar um semáforo funcional com este tutorial detalhado. Descubra como implementar a lógica de controle de um semáforo usando HTML, CSS e JavaScript.

Animação Roleta de Prêmios - HTML, CSS e JavaScript - Tutorial

Animação Roleta de Prêmios: Descubra como criar uma animada roleta de prêmios com este tutorial detalhado. Este projeto consiste em uma Animação,  uma roleta