➢CSS transforms allow you to move, rotate, scale, and skew elements.
➢With the CSS transform property you can use the following 2D transformation methods:
➢translate()
➢rotate()
➢scaleX()
➢scaleY()
➢scale()
➢skewX()
➢skewY()
➢skew()
➢matrix()
➢The translate() method moves an element from its current position (according to the parameters given for the X-axis and the Y-axis).
EXAMPLE:
.bmr {
width: 250px;
height: 75px;
background-color: lightgreen;
transform: translate(50px,100px);
}
➢The rotate() method rotates an element clockwise or counter-clockwise according to a given degree.
EXAMPLE:
.bmr {
width: 250px;
height: 75px;
background-color: lightgreen;
border: 2px solid black;
}
.bmr2 {
transform: rotate(20deg)
}
➢The scale() method increases or decreases the size of an element (according to the parameters given for the width and height).
EXAMPLE:
.bmr {
width: 125px;
height: 75px;
background-color: lightgreen;
transform: scale(1,3);
}
➢The scaleX() method increases or decreases the width of an element.
EXAMPLE:
.bmr {
width: 125px;
height: 75px;
background-color: lightgreen;
border: 2px solid black;
transform: scaleX(1);
}
➢The scaleY() method increases or decreases the height of an element.
EXAMPLE:
.bmr {
width: 125px;
height: 75px;
border: 2px solid black;
transform: scaleY(3);
}
➢The skewX() method skews an element along the X-axis by the given angle.
EXAMPLE:
.bmr {
width: 250px;
height: 75px;
}
.bmr2 {
transform: skewX(25deg);
}
➢The skewY() method skews an element along the Y-axis by the given angle.
EXAMPLE:
.bmr {
width: 250px;
height: 75px;
background-color: lightgreen;
border: 2px solid black;
}
.bmr2 {
transform: skewY(35deg);
}
➢The skew() method skews an element along the X and Y-axis by the given angles.
EXAMPLE:
.bmr {
width: 250px;
height: 75px;
background-color: lightgreen;
border: 2px solid black;
}
.bmr2 {
transform: skew(25deg,8deg);
}
➢The matrix()method combines all the 2D transform methods into one.
EXAMPLE:
.bmr {
width: 250px;
height: 75px;
background-color: lightgreen;
border: 2px solid black;
}
.bmr2 {
transform: matrix(1, -0.5, 0, 1, 0, 0);
}