rotating a div in css code example

Example 1: image rotate with css

div {
  width: 80px;
  height: 80px;
  background-color: skyblue;
}

.rotated {
  transform: rotate(45deg); /* Equal to rotateZ(45deg) */
  background-color: pink;
}

Example 2: css rotate

<style>
div {
  width: 80px;
  height: 80px;
  background-color: skyblue;
}
.rotated {
  transform: rotate(45deg);
  background-color: pink;
}
</style>

/* In body of html doc */
<div>Normal</div>
<div class="rotated">Rotated</div>

Example 3: css transform size

.selector {
  transform: scale(1.2); // Will upscale to 1.2
}

Example 4: css scale

scale(sx)

scale(sx, sy)

Tags:

Css Example