Course Content
CSS Basic
0/1
CSS Selectors
0/1
CSS Comments
0/1
CSS Backgrounds
0/1
CSS Borders
0/1
CSS Outline
0/1
CSS Fonts
0/1
CSS Height and Width
0/1
CSS Margins and Paddings
0/2
CSS Icons
0/1
CSS Links
0/1
CSS Lists
0/1
CSS Tables
0/1
CSS Display Properties
0/1
CSS Max-Width Property
0/1
CSS Positioning Elements
0/1
CSS Z-Index Property
0/1
CSS Overflow
0/1
CSS Float
0/1
CSS Opacity
0/1
CSS Forms
0/1
CSS Dropdowns
0/1
CSS Buttons
0/1
CSS Media Queries
0/1
About Lesson

CSS provides several 2D transform functions that allow you to modify the appearance and layout of elements in two-dimensional space. These transformations include translation, rotation, scaling, and skewing. Here are the main types of 2D transform functions:

Moves an element horizontally and/or vertically from its original position.

HTML
<!DOCTYPE html>
<html lang="en">
<head>
       
    <meta charset="UTF-8">
       
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>2D Transforms</title>
</head>

<body>
    <div class="translate-example">This is translated</div>
</body>


</html>
CSS
.translate-example {
  transform: translate(50px, 20px);
  background-color: aqua;
}

Rotates an element clockwise or counterclockwise around a specified point..

HTML
<!DOCTYPE html>
<html lang="en">
<head>
       
    <meta charset="UTF-8">
       
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>2D Transforms</title>
</head>

<body>
    <div class="rotate-example">This is rotated</div>
</body>


</html>
CSS
.rotate-example {
  transform: rotate(45deg);
  background-color: aqua;
  width:400px;
}

Scales an element up or down in size along the horizontal and vertical axes.

HTML
<!DOCTYPE html>
<html lang="en">
<head>
       
    <meta charset="UTF-8">
       
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>2D Transforms</title>
</head>

<body>
    <div class="scale-example">This is scaled</div>
</body>


</html>
CSS
.scale-example {
  transform: scale(1.5, 0.5);
}

Skews an element by tilting it along the horizontal and/or vertical axes..

HTML
<!DOCTYPE html>
<html lang="en">
<head>
       
    <meta charset="UTF-8">
       
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>2D Transforms</title>
</head>

<body>
    <div class="skew-example">This is skewed</div>
</body>


</html>
CSS
.skew-example {
  transform: skew(30deg, 20deg);
}