translateY in css code example

Example 1: transform:translateX()

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

Example 2: css transform size

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

Example 3: 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 4: translateY

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

.moved {
  transform: translateY(10px);
  background-color: pink;
}

Example 5: translate css property

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

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

Tags:

Misc Example