CSS 2D TRANSFORMS

In this example below you will see how to do a CSS 2D TRANSFORMS with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by koushik91, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright koushik91 ©
  • HTML
  • CSS
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>CSS 2D TRANSFORMS</title>
  
  
  
      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  <div class="rotate">Rotate</div>
<div id="translateX">Translatex</div>
<div id="translateY">Translatey</div>
<div id="translate">Translate</div>
<div id="scale">scale</div><!-- scale x and scale Y available -->
<div id="skew">SKEW</div>
  
  

</body>

</html>

/*Downloaded from https://www.codeseek.co/koushik91/css-2d-transforms-gRwzdW */
div{
  margin-top: 20px;
  background-color: skyblue;
  width: 100px;
  height: 100px;
}
#translateX,#translateY,#translate,.rotate,#scale{
  transition: transform 0.25s ease;
  cursor: pointer;
}
div.rotate:hover{
    /* Rotate div */
    -ms-transform: rotate(7deg); /* IE 9 */
    -webkit-transform: rotate(7deg); /* Chrome, Safari, Opera */
    transform: rotate(7deg);
}



#translateX:hover {
    transform:translateX(20px);
}
#translateY:hover {
    transform:translateY(20px);
}
#translate:hover{
  transform: translate(20px,20px);
}
#scale:hover {
    transform:scale(0.9);
}
#skew:hover {
    transform:skew(10deg,10deg);
}

Comments