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>MacBook revolves in Air</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="macbook">
<div class="macbook-inner">
<div class="screen">
<div class="face-one">
<div class="camera"></div>
<div class="display">
<div class="shade"></div>
</div>
<span>MacBook Air</span>
</div>
<img src="./apple-white-logo.png" alt="logo" class="logo">
</div>
<div class="body">
<div class="face-one">
<div class="touchpad"></div>
<div class="keyboard">
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key space"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key"></div>
<div class="key f"></div>
<div class="key f"></div>
<div class="key f"></div>
<div class="key f"></div>
<div class="key f"></div>
<div class="key f"></div>
<div class="key f"></div>
<div class="key f"></div>
<div class="key f"></div>
<div class="key f"></div>
<div class="key f"></div>
<div class="key f"></div>
<div class="key f"></div>
<div class="key f"></div>
<div class="key f"></div>
<div class="key f"></div>
</div>
</div>
<div class="pad one"></div>
<div class="pad two"></div>
<div class="pad three"></div>
<div class="pad four"></div>
</div>
</div>
<div class="shadow"></div>
</div>
</body>
</html>
Below is the css code for this video.
style.css
* {
margin: 0;
padding: 0;
}
body {
height: 100vh;
width: 100%;
background: radial-gradient(#fb8085, #f9c1b1);
overflow: hidden;
}
.macbook {
position: absolute;
top: 50%;
left: 50%;
margin: -150px 0 0 -96px;
height: 192px;
width: 300px;
perspective: 500px;
}
.macbook-inner {
position: absolute;
top: 0;
left: 0;
height: 192px;
width: 300px;
transform: rotateX(-20deg) rotateY(0deg) rotateZ(0deg);
transform-style: preserve-3d;
z-index: 20;
animation: rotateMacBookAnim 7s infinite ease;
}
@keyframes rotateMacBookAnim {
0% {
transform: rotateX(-20deg) rotateY(0deg) rotateZ(0deg);
}
5% {
transform: rotateX(-20deg) rotateY(-20deg) rotateZ(0deg);
}
20% {
transform: rotateX(30deg) rotateY(200deg) rotateZ(0deg);
}
25% {
transform: rotateX(-60deg) rotateY(150deg) rotateZ(0deg);
}
60% {
transform: rotateX(-20deg) rotateY(130deg) rotateZ(0deg);
}
65% {
transform: rotateX(-20deg) rotateY(120deg) rotateZ(0deg);
}
80%, 85% {
transform: rotateX(-20deg) rotateY(357deg) rotateZ(0deg);
}
87%, 100% {
transform: rotateX(-20deg) rotateY(360deg) rotateZ(0deg);
}
}
.screen {
position: absolute;
left: 0;
bottom: 0;
height: 192px;
width: 300px;
background: #ddd;
transform-origin: 50% 186px;
transform-style: preserve-3d;
transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
background-image: linear-gradient(45deg, #00000040 0%, #00000000 100%);
border-radius: 8px;
background-position: left bottom;
background-size: 600px 600px;
box-shadow: inset 0 6px 14px #ffffff80;
animation: screenAnim 7s infinite ease;
}
@keyframes screenAnim {
0% {
transform: rotateX(0deg);
background-position: left bottom;
}
5% {
transform: rotateX(50deg);
background-position: left bottom;
}
20% {
transform: rotateX(-90deg);
background-position: -150px top;
}
25% {
transform: rotateX(15deg);
background-position: left bottom;
}
30% {
transform: rotateX(-5deg);
background-position: right top;
}
38% {
transform: rotateX(5deg);
background-position: right top;
}
48%, 90% {
transform: rotateX(0deg);
background-position: right top;
}
100% {
transform: rotateX(0deg);
background-position: right center;
}
}
.screen .logo {
position: absolute;
top: 50%;
left: 50%;
margin: -20px 0 0 -20px;
height: 40px;
width: 40px;
transform: rotateY(180deg) translateZ(0.1px);
}
.screen .face-one {
position: absolute;
left: 0;
bottom: 0;
height: 192px;
width: 300px;
border-radius: 8px;
background: #d3d3d3;
transform: translateZ(4px);
background-image: linear-gradient(45deg, #00000040 0%, #00000000 100%);
}
.screen .face-one .camera {
position: absolute;
top: 8px;
left: 50%;
height: 6px;
width: 6px;
border-radius: 50%;
background: #000000;
margin-left: -3px;
}
.screen .face-one .display {
position: relative;
height: 150px;
width: 260px;
margin: 20px;
background: url('./desktop-wallpaper.webp') center center #000;
background-repeat: no-repeat;
background-size: 100% 100%;
border-radius: 2px;
box-shadow: inset 0 0 4px #000000;
}
.screen .face-one .display .shade {
position: absolute;
top: 0;
left: 0;
height: 150px;
width: 260px;
background: linear-gradient(-135deg, #ffffff00 0%, #ffffff1a 47%, #ffffff00 48%);
background-size: 600px 400px;
background-position: 0 0;
animation: screenShadeAnim 7s infinite ease;
}
@keyframes screenShadeAnim {
0%, 90%, 100% {
background-position: -20px 0;
}
5% {
background-position: -40px 0;
}
20% {
background-position: 200px 0;
}
50% {
background-position: -200px 0;
}
80% {
background-position: 0 0;
}
85% {
background-position: -30px 0;
}
}
.screen .face-one span {
position: absolute;
top: 170px;
left: 120px;
margin-top: 2px;
color: #666666;
font-size: 12px;
}
.body {
position: absolute;
left: 0;
bottom: 0;
height: 192px;
width: 300px;
background: #cbcbcb;
border-radius: 8px;
transform-style: preserve-3d;
transform-origin: 50% bottom;
transform: rotateX(-90deg);
background-image: linear-gradient(45deg, #00000040 0%, #00000000 100%);
animation: bodyAnim 7s infinite ease;
}
@keyframes bodyAnim {
0%, 50%, 100% {
transform: rotateX(-90deg);
}
}
.body .face-one {
position: absolute;
left: 0;
bottom: 0;
height: 192px;
width: 300px;
border-radius: 8px;
transform-style: preserve-3d;
background: #dfdfdf;
transform: translateZ(-4px);
background-image: linear-gradient(30deg, #00000040 0%, #00000000 100%);
animation: keyboardAnim 7s infinite ease;
}
@keyframes keyboardAnim {
0%, 100% {
background-color: #dfdfdf;
}
50% {
background-color: #bbbbbb;
}
}
.body .touchpad {
position: absolute;
top: 50%;
left: 50%;
margin: -88px 0 0 -36px;
height: 60px;
width: 80px;
border-radius: 8px;
background-color: #cdcdcd;
background-image: linear-gradient(30deg, #00000040 0%, #00000000 100%);
box-shadow: inset 0 0 6px #888888;
}
.body .keyboard {
position: absolute;
top: 82px;
left: 14px;
height: 90px;
width: 260px;
border-radius: 8px;
background: #cdcdcd;
transform-style: preserve-3d;
background-image: linear-gradient(30deg, #00000040 0%, #00000000 100%);
margin: 0 0 0 4px;
padding: 0 0 0 4px;
box-shadow: inset 0 0 6px #777777;
}
.keyboard .key {
height: 12px;
width: 12px;
background: #444444;
float: left;
margin: 2px;
transform: translateZ(-4px);
border-radius: 4px;
box-shadow: 0 -4px 0 #222222;
animation: keysAnim 7s infinite ease;
}
@keyframes keysAnim {
0%, 80%, 85%, 87%, 100% {
box-shadow: 0 -2px 0 #222222;
}
5%, 20%, 25%, 60% {
box-shadow: -1px 1px 0 #222222;
}
}
.key.space {
width: 90px;
}
.key.f {
height: 6px;
}
.body .pad {
position: absolute;
height: 10px;
width: 10px;
background: #333333;
border-radius: 50%;
}
.pad.one {
left: 40px;
top: 40px;
}
.pad.two {
right: 40px;
top: 40px;
}
.pad.three {
right: 40px;
bottom: 40px;
}
.pad.four {
left: 40px;
bottom: 40px;
}
.shadow {
position: absolute;
left: 80px;
top: 320px;
height: 0;
width: 120px;
transform: rotateX(80deg) rotateY(0deg) rotateZ(0deg);
box-shadow: 0 0 120px 80px #00000040;
animation: shadowAnim 7s infinite ease;
}
@keyframes shadowAnim {
0% {
transform: rotateX(80deg) rotateY(0deg) rotateZ(0deg);
box-shadow: 0 0 120px 80px #00000040;
}
5% {
transform: rotateX(80deg) rotateY(10deg) rotateZ(0deg);
box-shadow: 0 0 120px 80px #00000040;
}
20% {
transform: rotateX(30deg) rotateY(-20deg) rotateZ(-20deg);
box-shadow: 0 0 100px 60px #00000040;
}
25% {
transform: rotateX(80deg) rotateY(-20deg) rotateZ(50deg);
box-shadow: 0 0 70px 30px #0000001a;
}
60% {
transform: rotateX(80deg) rotateY(0deg) rotateZ(-50deg) translateX(30px);
box-shadow: 0 0 120px 80px #00000040;
}
100% {
box-shadow: 0 0 120px 80px #00000040;
}
}
Thanks for visiting