The content on this website, including videos and code examples, is for educational purposes only. All demonstrations and designs are fictional and created to illustrate coding techniques. Any resemblance to existing websites or brands is purely coincidental.
The creators and administrators of this website do not claim ownership or affiliation with any existing websites or companies. Users are encouraged to use the information responsibly for learning purposes. Liability for any misuse of the content provided is not accepted.
Below is the html code for this video.
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Typewriter using CSS only</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="typewriter">
<div class="typewriter-head"><i></i></div>
<div class="paper-in-typewriter"></div>
<div class="typewriter-keyboard"></div>
</div>
</body>
</html>
Below is the css code for this video.
style.css
*, *::before, *::after {
margin: 0;
padding: 0;
box-sizing: inherit;
}
html {
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
}
body {
display: flex;
height: 100vh;
width: 100%;
justify-content: center;
align-items: center;
background-color: #ff8489;
background-image: radial-gradient(#ff8489, #d5adc8);
}
.typewriter {
position: relative;
animation: bounceTypewriterAnim 6s linear infinite;
}
@keyframes bounceTypewriterAnim {
85%, 92%, 100% {
transform: translateY(0);
}
89% {
transform: translateY(-16px);
}
95% {
transform: translateY(8px);
}
}
.typewriter .typewriter-head {
height: 80px;
width: 368px;
background-color: #87ceeb;
background-image: linear-gradient(#87ceeb, #4169e1);
margin-left: 56px;
transform: translateX(56px);
border-radius: 12px;
animation: slideTypewriterHeadAnim 6s ease infinite;
}
@keyframes slideTypewriterHeadAnim {
5%, 100% {
transform: translateX(56px);
}
15%, 30% {
transform: translateX(24px);
}
40%, 55% {
transform: translateX(0);
}
65%, 70% {
transform: translateX(-16px);
}
80%, 89% {
transform: translateX(-48px);
}
}
.typewriter .typewriter-head::after, .typewriter .typewriter-head::before, .typewriter .typewriter-head i::before {
content: "";
position: absolute;
background-color: #edd94c;
}
.typewriter .typewriter-head::before {
top: 24px;
left: 100%;
height: 32px;
width: 8px;
}
.typewriter .typewriter-head::after {
left: 376px;
top: 12px;
height: 56px;
width: 24px;
border-radius: 12px;
}
.typewriter .typewriter-head i {
position: absolute;
top: 16px;
right: 100%;
display: block;
height: 16px;
width: 24px;
background-color: #edd94c;
}
.typewriter .typewriter-head i::before {
top: -8px;
right: 100%;
height: 56px;
width: 16px;
border-radius: 8px;
}
.typewriter .paper-in-typewriter {
position: absolute;
top: -104px;
left: 96px;
height: 184px;
width: 260px;
background-color: #e0e1e4;
border-radius: 20px;
transform: translateY(184px);
animation: movingPaperAnim 6s linear infinite;
}
@keyframes movingPaperAnim {
5%, 92%, 100% {
transform: translateY(184px);
}
20%, 30% {
transform: translateY(136px);
}
40%, 50% {
transform: translateY(88px);
}
65%, 70% {
transform: translateY(40px);
}
80%, 85% {
transform: translateY(0);
}
}
.typewriter .paper-in-typewriter::before {
content: "";
position: absolute;
top: 28px;
left: 24px;
right: 24px;
height: 16px;
background-color: #b8b8b8;
border-radius: 8px;
transform: scaleY(0.75);
box-shadow: 0 48px 0 #b8b8b8, 0 96px 0 #b8b8b8, 0 144px 0 #b8b8b8;
}
.typewriter .typewriter-keyboard {
position: relative;
height: 224px;
width: 480px;
margin-top: -40px;
z-index: 1;
}
.typewriter .typewriter-keyboard::after, .typewriter .typewriter-keyboard::before {
content: "";
position: absolute;
}
.typewriter .typewriter-keyboard::before {
top: 0;
left: 0;
bottom: 0;
right: 0;
background-color: #87ceeb;
background-image: linear-gradient(135deg, #87ceeb, #4169e1);
border-radius: 28px;
transform: perspective(40px) rotateX(2deg);
transform-origin: 50% 100%;
}
.typewriter .typewriter-keyboard::after {
top: 100px;
left: 8px;
height: 16px;
width: 44px;
border-radius: 8px;
box-shadow: 60px 0 0 #fff, 120px 0 0 #fff, 180px 0 0 #fff, 240px 0 0 #fff, 300px 0 0 #fff, 360px 0 0 #fff,
88px 40px 0 #fff, 148px 40px 0 #fff, 208px 40px 0 #fff, 240px 40px 0 #fff, 272px 40px 0 #fff, 332px 40px 0 #fff;
animation: typingOnKeyboardAnim 3s linear infinite;
}
@keyframes typingOnKeyboardAnim {
5%, 12%, 21%, 30%, 39%, 48%, 57%, 66%, 75%, 84%, 93% {
box-shadow: 60px 0 0 #fff, 120px 0 0 #fff, 180px 0 0 #fff, 240px 0 0 #fff, 300px 0 0 #fff, 360px 0 0 #fff,
88px 40px 0 #fff, 148px 40px 0 #fff, 208px 40px 0 #fff, 240px 40px 0 #fff, 272px 40px 0 #fff, 332px 40px 0 #fff;
}
9% {
box-shadow: 60px 8px 0 #fff, 120px 0 0 #fff, 180px 0 0 #fff, 240px 0 0 #fff, 300px 0 0 #fff, 360px 0 0 #fff,
88px 40px 0 #fff, 148px 40px 0 #fff, 208px 40px 0 #fff, 240px 40px 0 #fff, 272px 40px 0 #fff, 332px 40px 0 #fff;
}
18% {
box-shadow: 60px 0 0 #fff, 120px 0 0 #fff, 180px 0 0 #fff, 240px 8px 0 #fff, 300px 0 0 #fff, 360px 0 0 #fff,
88px 40px 0 #fff, 148px 40px 0 #fff, 208px 40px 0 #fff, 240px 40px 0 #fff, 272px 40px 0 #fff, 332px 40px 0 #fff;
}
27% {
box-shadow: 60px 0 0 #fff, 120px 0 0 #fff, 180px 0 0 #fff, 240px 0 0 #fff, 300px 0 0 #fff, 360px 0 0 #fff,
88px 48px 0 #fff, 148px 40px 0 #fff, 208px 40px 0 #fff, 240px 40px 0 #fff, 272px 40px 0 #fff, 332px 40px 0 #fff;
}
36% {
box-shadow: 60px 0 0 #fff, 120px 0 0 #fff, 180px 0 0 #fff, 240px 0 0 #fff, 300px 0 0 #fff, 360px 0 0 #fff,
88px 40px 0 #fff, 148px 40px 0 #fff, 208px 48px 0 #fff, 240px 48px 0 #fff, 272px 48px 0 #fff, 332px 40px 0 #fff;
}
45% {
box-shadow: 60px 0 0 #fff, 120px 0 0 #fff, 180px 0 0 #fff, 240px 0 0 #fff, 300px 0 0 #fff, 360px 8px 0 #fff,
88px 40px 0 #fff, 148px 40px 0 #fff, 208px 40px 0 #fff, 240px 40px 0 #fff, 272px 40px 0 #fff, 332px 40px 0 #fff;
}
54% {
box-shadow: 60px 0 0 #fff, 120px 8px 0 #fff, 180px 0 0 #fff, 240px 0 0 #fff, 300px 0 0 #fff, 360px 0 0 #fff,
88px 40px 0 #fff, 148px 40px 0 #fff, 208px 40px 0 #fff, 240px 40px 0 #fff, 272px 40px 0 #fff, 332px 40px 0 #fff;
}
63% {
box-shadow: 60px 0 0 #fff, 120px 0 0 #fff, 180px 0 0 #fff, 240px 0 0 #fff, 300px 0 0 #fff, 360px 0 0 #fff,
88px 40px 0 #fff, 148px 40px 0 #fff, 208px 40px 0 #fff, 240px 40px 0 #fff, 272px 40px 0 #fff, 332px 48px 0 #fff;
}
72% {
box-shadow: 60px 0 0 #fff, 120px 0 0 #fff, 180px 8px 0 #fff, 240px 0 0 #fff, 300px 0 0 #fff, 360px 0 0 #fff,
88px 40px 0 #fff, 148px 40px 0 #fff, 208px 40px 0 #fff, 240px 40px 0 #fff, 272px 40px 0 #fff, 332px 40px 0 #fff;
}
81% {
box-shadow: 60px 0 0 #fff, 120px 0 0 #fff, 180px 0 0 #fff, 240px 0 0 #fff, 300px 0 0 #fff, 360px 0 0 #fff,
88px 40px 0 #fff, 148px 48px 0 #fff, 208px 40px 0 #fff, 240px 40px 0 #fff, 272px 40px 0 #fff, 332px 40px 0 #fff;
}
90% {
box-shadow: 60px 0 0 #fff, 120px 0 0 #fff, 180px 0 0 #fff, 240px 0 0 #fff, 300px 8px 0 #fff, 360px 0 0 #fff,
88px 40px 0 #fff, 148px 40px 0 #fff, 208px 40px 0 #fff, 240px 40px 0 #fff, 272px 40px 0 #fff, 332px 40px 0 #fff;
}
}
Thanks for visiting