Skip to content
Youths Forum Youths Forum Youths Forum

Tech Blogs & Programming Tutorials

Youths Forum Youths Forum Youths Forum

Tech Blogs & Programming Tutorials

  • Blog
  • News
  • Programming
    • PHP
    • JavaScript
    • JQuery
    • CSS
    • HTML
    • API
  • Stock Market Live
  • Automobiles
    • Cars
  • Gadgets
    • Phones
    • Android Phones

Categories

  • Artificial Intelligence (1)
  • Automobiles (12)
    • Cars (7)
  • Blog (104)
    • Poems (2)
    • Space (2)
  • Command (2)
  • Education (2)
  • Entertainment (4)
  • Gadgets (9)
    • Phones (8)
      • Android Phones (4)
  • HTML Templates (11)
  • IT Training Institutes (1)
  • Lifestyle (4)
  • News (108)
  • Others (23)
  • Programming (296)
    • API (16)
    • CSS (83)
    • Database (4)
    • Hosting (1)
    • HTML (37)
    • JavaScript (117)
      • JQuery (27)
      • ReactJS (7)
    • PHP (116)
  • Python (3)
  • recipes (1)
  • SEE Result (1)
  • Server (3)
  • Blog
  • News
  • Programming
    • PHP
    • JavaScript
    • JQuery
    • CSS
    • HTML
    • API
  • Stock Market Live
  • Automobiles
    • Cars
  • Gadgets
    • Phones
    • Android Phones
Close

Search

CSS

Rotating 3D Cube effect using HTML and CSS

By Admin
March 9, 2021 2 Min Read
0

In this article, we are going to learn to make 3D Cube using HTML and CSS and then rotate it using css transform property.

Full Source Code :

<html>
    <head>
        <style type="text/css">
            .stage{
            	margin:0 auto;
            }
            @-webkit-keyframes spincube {
            from,
            to {
            -webkit-transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
            }
            16% {
            -webkit-transform: rotateY(-90deg);
            }
            33% {
            -webkit-transform: rotateY(-90deg) rotateZ(90deg);
            }
            50% {
            -webkit-transform: rotateY(-180deg) rotateZ(90deg);
            }
            66% {
            -webkit-transform: rotateY(-270deg) rotateX(90deg);
            }
            83% {
            -webkit-transform: rotateX(90deg);
            }
            }
            @keyframes spincube {
            from,
            to {
            -moz-transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
            -ms-transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
            transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
            }
            16% {
            -moz-transform: rotateY(-90deg);
            -ms-transform: rotateY(-90deg);
            transform: rotateY(-90deg);
            }
            33% {
            -moz-transform: rotateY(-90deg) rotateZ(90deg);
            -ms-transform: rotateY(-90deg) rotateZ(90deg);
            transform: rotateY(-90deg) rotateZ(90deg);
            }
            50% {
            -moz-transform: rotateY(-180deg) rotateZ(90deg);
            -ms-transform: rotateY(-180deg) rotateZ(90deg);
            transform: rotateY(-180deg) rotateZ(90deg);
            }
            66% {
            -moz-transform: rotateY(-270deg) rotateX(90deg);
            -ms-transform: rotateY(-270deg) rotateX(90deg);
            transform: rotateY(-270deg) rotateX(90deg);
            }
            83% {
            -moz-transform: rotateX(90deg);
            -ms-transform: rotateX(90deg);
            transform: rotateX(90deg);
            }
            }
            .cubespinner {
            -webkit-animation-name: spincube;
            -webkit-animation-timing-function: ease-in-out;
            -webkit-animation-iteration-count: infinite;
            -webkit-animation-duration: 20s;
            animation-name: spincube;
            animation-timing-function: ease-in-out;
            animation-iteration-count: infinite;
            animation-duration: 20s;
            -webkit-transform-style: preserve-3d;
            -moz-transform-style: preserve-3d;
            -ms-transform-style: preserve-3d;
            transform-style: preserve-3d;
            -webkit-transform-origin: 60px 60px 0;
            -moz-transform-origin: 60px 60px 0;
            -ms-transform-origin: 60px 60px 0;
            transform-origin: 60px 60px 0;
            }
            .cubespinner div {
            position: absolute;
            width: 250px;
            height: 250px;
            border: 1px solid #ccc;
            background: rgba(255, 255, 255, 0.8);
            box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
            text-align: center;
            font-size: 100px;
            }
            .cubespinner .face1 {
            -webkit-transform: translateZ(125px);
            -moz-transform: translateZ(125px);
            -ms-transform: translateZ(125px);
            transform: translateZ(125px);
            
            }
            .cubespinner .face2 {
            -webkit-transform: rotateY(90deg) translateZ(125px);
            -moz-transform: rotateY(90deg) translateZ(125px);
            -ms-transform: rotateY(90deg) translateZ(125px);
            transform: rotateY(90deg) translateZ(125px);
            }
            .cubespinner .face3 {
            -webkit-transform: rotateY(90deg) rotateX(90deg) translateZ(125px);
            -moz-transform: rotateY(90deg) rotateX(90deg) translateZ(125px);
            -ms-transform: rotateY(90deg) rotateX(90deg) translateZ(125px);
            transform: rotateY(90deg) rotateX(90deg) translateZ(125px);
            }
            .cubespinner .face4 {
            -webkit-transform: rotateY(180deg) rotateZ(90deg) translateZ(125px);
            -moz-transform: rotateY(180deg) rotateZ(90deg) translateZ(125px);
            -ms-transform: rotateY(180deg) rotateZ(90deg) translateZ(125px);
            transform: rotateY(180deg) rotateZ(90deg) translateZ(125px);
            }
            .cubespinner .face5 {
            -webkit-transform: rotateY(-90deg) rotateZ(90deg) translateZ(125px);
            -moz-transform: rotateY(-90deg) rotateZ(90deg) translateZ(125px);
            -ms-transform: rotateY(-90deg) rotateZ(90deg) translateZ(125px);
            transform: rotateY(-90deg) rotateZ(90deg) translateZ(125px);
            }
            .cubespinner .face6 {
            -webkit-transform: rotateX(-90deg) translateZ(125px);
            -moz-transform: rotateX(-90deg) translateZ(125px);
            -ms-transform: rotateX(-90deg) translateZ(125px);
            transform: rotateX(-90deg) translateZ(125px);
            }
        </style>
    </head>
    <body style="margin: 10em;">
        <div class="stage" style="width: 250px; height: 250px;">
            <div class="cubespinner">
                <div class="face1">
                    Face 1
                </div>
                <div class="face2">
                    Face 2
                </div>
                <div class="face3">
                    Face 3
                </div>
                <div class="face4">
                    Face 4
                </div>
                <div class="face5">
                    Face 5
                </div>
                <div class="face6">
                    Face 6
                </div>
            </div>
        </div>
    </body>
</html>

 

Follow this video for complete guidance :

Tags:

3dCSS
Author

Admin

Follow Me
Other Articles
Previous

The Secrets to Success

Next

Facebook Style Login Page Design using HTML and CSS

No Comment! Be the first one.

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • UAE Positive for Startup Investment in Nepal: Startup Summit 2026 Initiative
  • Radisson Hotel Raided, 184 Gas Cylinders Found Hidden
  • Special priority will be given to vehicles assembled in Nepal at NADA Auto Show: Surendrakumar Upareti
  • Ncell Investigation Report Public: Company Strongly Objects, Stating Foreign Investment Environment Clouded
  • Cooperation Agreement between CAN Federation and TJF on Technology Journalism and Digital Transformation

Tags

adsense ai animate animation animation using HTML and CSS API blog calculator chatgpt Cryptocurrency CSS css animation design Email Facebook featured filemanager file manager free template google htaccess HTML image Instagram interview javascript JQuery jquery ui NADA AutoShow NADA Auto Show 2024 password PHP Progressive Web App PWA QR random react reactjs Rotate travel Twitter vpn youthforum youthsforum youtube

About Us

At Youths Forum, we are passionate about sharing knowledge that empowers students, educators, professionals, and technology enthusiasts.

Our Mission

Our mission is simple: to make technology and education accessible, understandable, and beneficial for everyone. We strive to create content that helps our readers learn new skills and stay updated with industry developments.

RSS RSS

  • UAE Positive for Startup Investment in Nepal: Startup Summit 2026 Initiative Admin
  • Radisson Hotel Raided, 184 Gas Cylinders Found Hidden Admin
  • Special priority will be given to vehicles assembled in Nepal at NADA Auto Show: Surendrakumar Upareti Admin

Quick Links

  • Stock Market Live
  • Parliament Election 2082
Copyright 2026 — Youths Forum. All rights reserved. Blogsy WordPress Theme