
- CSS Tutorial
- CSS - Home
- CSS - Introduction
- CSS - Syntax
- CSS - Inclusion
- CSS - Measurement Units
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursors
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS Advanced
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Media Types
- CSS - Paged Media
- CSS - Aural Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS3 Tutorial
- CSS3 - Tutorial
- CSS3 - Rounded Corner
- CSS3 - Border Images
- CSS3 - Multi Background
- CSS3 - Color
- CSS3 - Gradients
- CSS3 - Shadow
- CSS3 - Text
- CSS3 - Web font
- CSS3 - 2d transform
- CSS3 - 3d transform
- CSS3 - Animation
- CSS3 - Multi columns
- CSS3 - User Interface
- CSS3 - Box Sizing
- CSS Responsive
- CSS - Responsive Web Design
- CSS References
- CSS - Questions and Answers
- CSS - Quick Guide
- CSS - References
- CSS - Color References
- CSS - Web browser References
- CSS - Web safe fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
2D Transformation of Elements using CSS3
2D transforms are used to re-change the element structure as translate, rotate, scale, and skew.
Following are some of the 2D transform functions −
Sr.No. | Value & Description |
---|---|
1 | matrix(n,n,n,n,n,n) Used to defines matrix transforms with six values |
2 | translate(x,y) Used to transforms the element along with x-axis and y-axis |
3 | translateX(n) Used to transforms the element along with x-axis |
4 | translateY(n) Used to transforms the element along with y-axis |
5 | scale(x,y) Used to change the width and height of element |
6 | scaleX(n) Used to change the width of element |
Following is the code for 2D transformation of elements using CSS3 −
Example
<!DOCTYPE html> <html> <head> <style> body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } div { width: 100px; height: 100px; background-color: rgb(255, 17, 0); border:2px solid black; margin: 20px; display: inline-block; color: white; } .rotate { transform: rotate(20deg); } .translate { transform: translate(30px, 20px); } .scale { transform: scale(2, 1); margin-left:70px; } .skew { transform: skew(20deg); } </style> </head> <body> <h1>2D transformation of elements </h1> <div class="rotate">ROTATE</div> <div class="skew">SKEW</div> <div class="scale">SCALE</div> <div class="translate">TRANSLATE</div> </body> </html>
Output
- Related Articles
- 2D transforms in CSS3
- Working with CSS3 2D Transform Functions
- Text Transformation using CSS
- How to apply a 2D or 3D transformation to an element with CSS
- Adjusting the Saturation of Images using CSS3
- Enable Wrapping of Flex Items using CSS3
- Setting Column Gap using CSS3
- Breaking Overflow Text using CSS3
- Performing multiple transitions using CSS3
- Explain OpenCV Laplacian Transformation using java Example
- Explain OpenCV Distance Transformation using java Example
- Adjusting the Image Contrast using CSS3
- Setting the Image Brightness using CSS3
- Applying Opacity to Images using CSS3
- Text in Transparent Box using CSS3

Advertisements