<h1 id="counter"></h1>
html,
body {
margin: 0;
padding: 0;
}
body {
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
}
body:before {
content: "";
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: -1;
background: linear-gradient(red, red);
background-size: 100% 0;
background-repeat: no-repeat;
}
h1 {
font-family: monospace;
margin: 0;
text-align: center;
padding: 1rem 2rem;
border: 5px solid #000;
letter-spacing: 5px;
font-size: 4rem;
background: #fff;
box-shadow: 0 0 20px 20px rgba(0, 0, 0, 0.5);
min-width: 8rem;
background: linear-gradient(#ccc, #eee);
mix-blend-mode: luminosity;
}
h1 * {
font-weight: bold;
font-style: normal;
}
.startBG:before {
animation: bg 5s linear forwards;
}
@keyframes bg {
100% {
background-size: 100% 100%;
}
}
(function (d) {
"use strict";
const myElement = d.getElementById("counter");
d.body.classList.add("startBG");
var counter = 0;
var countdown = setInterval(function () {
counter++;
myElement.textContent = counter;
if (counter == 100) clearInterval(countdown);
}, 50);
})(document);
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.