Creating 3D objects usually requires WebGL or Three.js.
But for simple UI elements, you can build a fully rotating holographic cube using only:
Clean. Fast. No libraries.
👇 Copy Code:
#CSS3D #WebDesign #Frontend #Snippet
But for simple UI elements, you can build a fully rotating holographic cube using only:
transform-style: preserve-3d
Clean. Fast. No libraries.
👇 Copy Code:
<style>
body{margin:0;height:100vh;background:#050505;display:flex;align-items:center;justify-content:center;perspective:800px}
.cube{width:100px;height:100px;position:relative;transform-style:preserve-3d;animation:spin 6s infinite linear}
.face{position:absolute;width:100px;height:100px;border:2px solid rgba(0,242,255,0.5);background:rgba(0,242,255,0.05);display:flex;align-items:center;justify-content:center;color:#00f2ff;font-size:12px;font-family:sans-serif;box-shadow:0 0 15px rgba(0,242,255,0.2)}
/* Positioning the 6 faces */
.front{transform:translateZ(50px)}
.back{transform:rotateY(180deg) translateZ(50px)}
.right{transform:rotateY(90deg) translateZ(50px)}
.left{transform:rotateY(-90deg) translateZ(50px)}
.top{transform:rotateX(90deg) translateZ(50px)}
.bottom{transform:rotateX(-90deg) translateZ(50px)}
@keyframes spin{0%{transform:rotateX(0deg) rotateY(0deg)}100%{transform:rotateX(360deg) rotateY(360deg)}}
</style>
<div class="cube">
<div class="face front">FRONT</div>
<div class="face back">BACK</div>
<div class="face right">RIGHT</div>
<div class="face left">LEFT</div>
<div class="face top">TOP</div>
<div class="face bottom">BTM</div>
</div>
#CSS3D #WebDesign #Frontend #Snippet