CSS Transforms
CSS transforms allow you to modify the appearance and position of an element without disrupting the normal document flow. They enable you to rotate, scale, skew, or translate an element.
.element {
ㅤtransform: function(value);
}
.translate-example {
ㅤtransform: translate(50px, 100px);
}
.rotate-example {
ㅤtransform: rotate(45deg);
}
.scale-example {
ㅤtransform: scale(1.5, 2);
}
.skew-example {
ㅤtransform: skew(20deg, 10deg);
}
You can apply multiple transforms to an element by separating them with spaces:
.multi-transform {
ㅤtransform: rotate(45deg) scale(1.5) translate(50px, 60px);
}
CSS also supports 3D transforms, allowing you to manipulate elements in three-dimensional space:
CSS transforms are well-supported in modern browsers. They can provide performance benefits over traditional positioning methods as they don't trigger reflows or repaints in many cases.
CSS transforms provide powerful tools for manipulating elements visually without affecting document flow. They're essential for modern web design and can greatly enhance user interfaces when used appropriately.