Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to rotate in CSS3 around its axis

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 492
    Comment on it

    Hello, readers, this is a small blog on how to rotate in CSS3 around its axis. To achieve this we will make a file index.html. Copy the below-written code in this file.

    1. <!DOCTYPE html>
    2. <html>
    3. <head>
    4. <meta charset="utf-8">
    5. <title>Rotation around its axis</title>
    6.  
    7. <link rel="stylesheet" type="text/css" href="style.css">
    8. </head>
    9.  
    10.  
    11. <body>
    12.  
    13. <div class="wrapper-x">S</div>
    14. <div class="wrapper-y">S</div>
    15.  
    16. </body>
    17.  
    18. </html>

     

    Next, we will make style.css and copy the below written below.

    1. .wrapper-x
    2. {
    3. position: absolute;
    4. left: 45%;
    5. top:30%;
    6. font-size:90px;
    7. -webkit-animation: spinX 5s infinite;
    8.  
    9. }
    10.  
    11.  
    12. .wrapper-y
    13. {
    14. position: absolute;
    15. left: 45%;
    16. top:30%;
    17. width:50px;
    18. font-size:90px;
    19. -webkit-animation: spinY 5s infinite;
    20.  
    21. }
    22.  
    23.  
    24. @-webkit-keyframes spinX
    25. {
    26. 0% {-webkit-transform: rotateX(0deg); -webkit-transform-origin: 0% 50% 0;}
    27. 100% {-webkit-transform: rotateX(360deg); -webkit-transform-origin: 0% 50% 0;}
    28. }
    29.  
    30.  
    31. @-webkit-keyframes spinY
    32. {
    33. 0% {-webkit-transform: rotateY(0deg); -webkit-transform-origin: 0% 0% 5;}
    34. 100% {-webkit-transform: rotateY(360deg); -webkit-transform-origin: 0% 0% 5;}
    35. }

     

    Comment: Transforms have a "transform-origin" property. When transform origin is not specified, it is automatically set at (50%, 50%) of the element. The 0% and 100% represent your "from" and "to" clauses, this allows you to add a number of lines as you wish to increment the movement over your specified timeframe.

     

    Note:-The transform property supports  all latest version of Safari 3.2+, Chrome 4+
    , Firefox 3.5+, Opera 10.5+, and IE 9.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: