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>Documenttitle>
<link rel="stylesheet" href="./css/cube.css">
<style>
@keyframes turn {
from { transform: rotate3d(0, 0, 0, 0); }
to { transform: rotate3d(1, 1, 0, 360deg); }
}
.container {
width: 200px;
height: 200px;
perspective: 500px;
margin: 100px;
}
.cube {
position: relative;
width: 200px;
height: 200px;
transform-style: preserve-3d;
animation: turn 5s linear infinite;
}
.face {
width: 200px;
height: 200px;
background: rgb(242,0,106);
background: radial-gradient(circle, rgba(242,0,106,.5) 0%, rgba(11,114,235,.5) 100%);
border: 2px solid black;
position: absolute;
display: flex;
align-items: center;
justify-content: center;
font-family: Arial, sans-serif;
font-size: 2rem;
transition: transform .5;
}
.front {
transform: translateZ(120px);
}
.back {
transform: translateZ(-120px) rotateY(180deg);
}
.left {
transform: translateX(-120px) rotateY(-90deg);
}
.right {
transform: translateX(120px) rotateY(90deg);
}
.top {
transform: translateY(-120px) rotateX(90deg);
}
.bottom {
transform: translateY(120px) rotateX(-90deg);
}
@media (prefers-reduced-motion: reduce) {
.cube {
animation: none;
transform: rotate3d(1, 1, 0, 45deg);
}
}
style>
head>
<body>
<div class="container">
<div class="cube">
<div class="face top">Topdiv>
<div class="face bottom">Bottomdiv>
<div class="face left">Leftdiv>
<div class="face right">Rightdiv>
<div class="face front">Frontdiv>
<div class="face back">Backdiv>
div>
div>
body>