<div class="message">
<div><span>Happy holidays!</span></div>
</div>
<div class="tree">
<div class="part top"><span></span></div>
<div class="part middle"><span></span></div>
<div class="part bottom"><span><span></span></span></div>
</div>
@import url("https://fonts.googleapis.com/css2?family=Courgette&display=swap");
:root {
--tree-color: #345b4d;
}
.tree {
display: flex;
flex-direction: column;
align-items: center;
}
.tree::before {
width: 8vw;
height: 6vw;
margin-bottom: -1px;
clip-path: polygon(50% 0, 100% 100%, 0 100%);
background: var(--tree-color);
content: "";
transform: translateY(100%) scale(0);
animation: pop-in .4s ease-out forwards;
animation-delay: 1.7s;
}
.tree::after {
width: 6vw;
height: 8vw;
content: "";
background: rgb(200, 111, 51);
}
/* part styling. */
.part {
position: relative;
margin-bottom: -1px;
background: var(--tree-color);
transform: translateY(100%) scale(0);
animation: pop-in .3s ease-out forwards;
}
.top {
width: 8vw;
height: 5vw;
animation-delay: 1.3s;
}
.middle {
width: 10vw;
height: 8vw;
animation-delay: .9s;
}
.bottom {
width: 15vw;
height: 13vw;
animation: scale-in .3s ease-out .5s forwards;
}
.part::before,
.part::after {
position: absolute;
width: 100%;
height: 100%;
clip-path: polygon(50% 0, 50% 100%, 0 100%);
transform: translateX(-49%);
background: var(--tree-color);
content: "";
}
.part::after {
clip-path: polygon(50% 0, 100% 100%, 0 500%);
transform: translateX(49%);
}
.part span,
.part span::before,
.part span::after {
--top: 200%;
--left: 400%;
position: absolute;
display: block;
top: 50%;
left: 50%;
width: 1vw;
height: 1vw;
border-radius: 50%;
background: hotpink;
animation: blink 4s ease-in-out infinite;
}
.part span::before,
.part span::after {
animation-delay: 2s;
content: "";
z-index: 2;
}
.part span::before {
left: calc(var(--left) / -1);
top: calc(var(--top) / -1);
}
.part span::after {
left: var(--left);
top: calc(var(--top) / 2);
}
/* Top specific. */
.top span {
animation-delay: 2.5s;
}
.top span::before,
.top span::after {
--top: 150%;
--left: 300%;
animation-delay: 3s;
}
/* Bottom specific. */
.bottom span::before,
.bottom span::after {
--top: 400%;
--left: 600%;
animation-delay: 2.8s;
}
.bottom span span {
background: transparent;
animation: none;
}
.bottom span span::before {
--top: 230%;
--left: 350%;
animation: blink 4s ease-in-out 6s infinite;
}
.bottom span {
animation-delay: 0.3s;
}
.bottom span span::after {
--top: 200%;
--left: 250%;
animation: blink 4s ease-in-out 5s infinite;
}
@keyframes blink {
0%,
40% {
background-color: hotpink;
box-shadow: none;
}
10% {
background-color: #fff;
box-shadow: 0 0 0.1vw 0.1vw #fff, 0 0 0.3vw 0.3vw hotpink, 0 0 0.5vw 0.5vw #0ff;
}
}
@keyframes pop-in {
0% {
transform: translateY(100%) scale(0);
}
1% {
transform: translateY(100%) scale(1);
}
100% {
transform: translateY(0) scale(1);
}
}
@keyframes scale-in {
0% {
transform: translateY(100%) scale(0);
}
1% {
transform: translateY(0) scale(0);
}
100% {
transform: translateY(0) scale(1);
}
}
/* General quick styling */
body {
display: flex;
flex-direction: column;
min-height: 100vh;
justify-content: flex-end;
padding-top: 30px;
margin: 0;
background: linear-gradient(
90deg,
rgba(255, 255, 255, 0.1) 50%,
transparent 50%
),
radial-gradient(rgba(37, 89, 87, 0.2) 90%, transparent 10%), #437c90;
background-size: 5vw 2vw, 5vw 8vw;
background-position: 8.75vw 0, -2.5vw -5vw;
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation: none !important;
}
}
*,
*::before,
*::after {
box-sizing: border-box;
}
.message {
display: none;
}
@media screen and (min-width: 786px) {
.message {
position: absolute;
top: 30px;
right: 30px;
display: flex;
align-items: center;
justify-content: center;
width: 320px;
height: 200px;
background: rgb(200, 111, 51);
border-radius: 17px;
z-index: -1;
}
.message div {
display: flex;
align-items: center;
justify-content: center;
font-family: "Courgette", cursive;
position: relative;
width: 300px;
height: 180px;
background: #efd6ac;
text-align: center;
font-size: 2.3rem;
color: #183a37;
border-radius: 18px;
}
.message span {
transform: rotate(-15deg) skew(-5deg);
}
}
@media screen and (max-width: 700px) {
.top {
width: 20vw;
height: 15vw;
}
.middle {
width: 25vw;
height: 20vw;
}
.bottom {
width: 30vw;
height: 20vw;
}
.tree::before {
width: 20vw;
height: 14vw;
}
.tree::after {
width: 8vw;
height: 11vw;
}
.part span,
.part span::before,
.part span::after {
width: 2vw;
height: 2vw;
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.