Transforms

2D Transforms

Example

<!DOCTYPE html>
<html>
<head>
  <title>Page Title</title>
  <style>
    div { display: inline-block; width: 70px; height: 70px; margin: 18px; background: #04AA6D; color: white; font: 12px Arial; text-align: center; line-height: 70px; }
    .r { transform: rotate(20deg); }
    .s { transform: scale(1.3); }
    .t { transform: translate(10px, 10px); }
    .k { transform: skew(15deg, 5deg); }
  </style>
</head>
<body>

<div>none</div><div class="r">rotate</div><div class="s">scale</div><div class="t">translate</div><div class="k">skew</div>

</body>
</html>

Result

Transform Origin and 3D

Example

Hover to flip the card in 3D:

<!DOCTYPE html>
<html>
<head>
  <title>Page Title</title>
  <style>
    .scene { perspective: 600px; width: 160px; height: 100px; font-family: Arial; }
    .flip { width: 100%; height: 100%; position: relative; transition: transform .6s; transform-style: preserve-3d; }
    .scene:hover .flip { transform: rotateY(180deg); }
    .face { position: absolute; inset: 0; display: grid; place-items: center; backface-visibility: hidden; color: white; border-radius: 8px; }
    .front { background: #282A35; }
    .back { background: #04AA6D; transform: rotateY(180deg); }
  </style>
</head>
<body>

<div class="scene"><div class="flip">
  <div class="face front">Front</div>
  <div class="face back">Back</div>
</div></div>

</body>
</html>

Result