Skip to main content

Design 3D Block with hover animation



        How To Design The 3D Block With Hover Effect.



The 3D block



Here is the code of How to design the 3D block design by using only html and css.
                    By using html-css you can make a lots of designs and animations. Few done by me
                    and somewhat expect from you . Try to watch all the videos by codoblog. And stay                                     connected.


                CODE - 

                  <html>
          <head>
<style type="text/css">
body{
background-color: black;
}
.wrap{
margin-top: 150px;
perspective:1000px;
perspective-origin:50% 50%;
}
.cube{
margin: auto;
position: relative;
height: 200px;
width: 200px;
transform-style:preserve-3d;
}
.cube > div{
position:absolute;
box-sizing:border-box;
padding: 10px;
height: 100%;
width: 100%;
opacity: 0.7;
background-color: #000;
border: solid 1px #eeeeee;
color: rgb(0.255,255);
}
.front{
transform:translateZ(100px);
background: green;
}
.back{
transform:translateZ(-100px) rotateY(180deg);
}
.top{
transform:rotateX(-270deg) translateY(-100px);
transform-origin: top center;
}
.bottom{
transform:rotateX(270deg) translateY(100px);
transform-origin:bottom center;
}
@keyframes rotate{
from{
transform: rotateX(0deg) rotateY(0deg);
}
to{
transform:rotateX(360deg) rotateY(360deg);
}
}
.cube{
animation:rotate 14s infinite linear;
}
.wrap:hover .back{
transform:translateZ(-200px) rotateY(180deg);
}
.wrap:hover .front{
transform:translateZ(200px);
}
.wrap:hover .top{
transform:rotateX(-270deg) translateZ(100px) translateY(-100px);
}
.wrap:hover .bottom{
transform:rotateX(270deg) translateZ(100px) translateY(100px);
}
.cube > div{
transition:transform 2s ease-out;
}
</style>
</head>
<body>
<div class="wrap">
  <div class="cube">
  <div class="front"></div>
  <div class="back"></div>
  <div class="top"></div>
  <div class="bottom"></div>
  </div>

</div>
</body>
</html>



  OUTPUT -
           

After Run the project.


&


After Hover



    Try to Write the code and bring the output. Also use in websites of your own .

    #Love CodoBlog

    Watch video if you miss something ::--||>

        

😃😃😃😃









 

Comments

The Most Populer

How to create Stopwatch by using Html and Javascript | Digital Stopwatch

How to create Stopwatch by using Html-Css-Javascript || Digital StopWatch  #CODE  :  <!DOCTYPE html> <html> <head> <title>Stopwatch</title> <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"> <style type="text/css"> body{ margin: 0;     padding: 0;     background-color: #6495ED;     box-sizing: border-box; } .con{ position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); border-radius: 5px; background: #ececec; box-shadow: 20px 20px 60px red, -20px -20px 60px #fff; height: 380px; width: 280px; } .time{ border-radius: 50%; background: #fff; box-shadow: inset 20px 20px 60px green, inset -20px -20px 60px #fff; height: 150px; width: 150px; position: absolute; margin: 60px 0 0 65px; transform: scale(1.5); } .buttons{ ...

Sidebar Icon | The Icon Interaction

 Sidebar icon with animation || Icon interaction HTML  Here is the code for designing an animation of the sidebar icon. This icon is helpful for the use of sidebar menus . With the effect of rounding opening and closing codoblog brings the video of the icon interaction for you. #CODE :        <!DOCTYPE html> <html> <head> <title>Icon menu</title> <style type="text/css"> body{ height: 100vh; display: flex; justify-content: center; align-items: center; margin: 0; font-family: sans-serif; font-weight: bold; flex-direction: column; } p{ font-size: 2.5rem; text-transform: uppercase; } svg{ stroke-linecap: round; stroke-linejoin: round; transition: transform 400ms; cursor: pointer; -webkit-tap-highlight-color:rgba(0,0,0,0); } svg path{ fill: none; stroke: black; stroke-width:2px; transition:stroke-dasharray 400ms,stroke-dashoffs...

Javascript FireCracker Animation

  || FireCracker Animation Using JavaScript ||  #CODE :                                                                              <!DOCTYPE html> <html> <head> <title>JavaScript FireDesign</title> <style type="text/css"> body{ background: #000; margin: 0; width: 100%; overflow: hidden; } </style> </head> <body> <canvas></canvas> <script type="text/javascript"> var t =0; var c = document.querySelector("canvas"); var $ = c.getContext('2d'); c.width = window.innerWidth; c.height = window.innerHeight; $.fillStyle = 'hsla(0,0%,0%,1)'; window.addEventListener('resize',function(){ c.width = window.innerWidth; c.height= window.innerHeight; },fa...