css get translate value code example

Example 1: translate css property

/* Single <length-percentage> values */
transform: translate(200px);
transform: translate(50%);

/* Double <length-percentage> values */
transform: translate(100px, 200px);
transform: translate(100px, 50%);
transform: translate(30%, 200px);
transform: translate(30%, 50%);
transform: translate(90%, 90%);

Example 2: translate css property

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

.moved {
  transform: translate(50px, 10px);
  background-color: pink;
}

Tags:

Css Example