Skip to content
This repository was archived by the owner on Feb 27, 2026. It is now read-only.

Commit 1aef087

Browse files
Adding skewX() entry (#8241)
* Add skewX entry Added skewX entry with its documentation * Add image for the code examples Added images to media folder and use them to show the output of the code examples * Revise skewX() documentation for accuracy Updated the skewX documentation to improve clarity and correctness, including syntax and examples. * Fix formatting of skewX value description * Clean up skewX.md by removing redundant text Removed unnecessary text before the CSS example. ---------
1 parent ce6964f commit 1aef087

3 files changed

Lines changed: 69 additions & 0 deletions

File tree

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
Title: 'skewX()'
3+
Description: 'Skews an element horizontally by a specified angle using the CSS transform property.'
4+
Subjects:
5+
- 'Web Design'
6+
- 'Web Development'
7+
Tags:
8+
- 'Functions'
9+
- 'Positioning'
10+
CatalogContent:
11+
- 'learn-css'
12+
- 'paths/front-end-engineer-career-path'
13+
---
14+
15+
**`skewX()`** is a CSS transform function that skews an element along the x-axis by the specified angle. It distorts the element horizontally, shifting its top and bottom edges left or right while preserving its vertical orientation.
16+
17+
## Syntax
18+
19+
```pseudo
20+
transform: skewX(<value>);
21+
```
22+
23+
**Parameters:**
24+
25+
- `<angle>`: Specifies the skew amount. Accepts any valid CSS angle unit:
26+
- Degrees (`deg`)
27+
- Radians (`rad`)
28+
- Gradians (`grad`)
29+
- Turns (`turn`)
30+
31+
The value may be positive or negative.
32+
33+
**Return value:**
34+
35+
None. This function produces a transform value that modifies the element’s rendering when applied through the `transform` property.
36+
37+
## Example 1: Skewing by Degrees
38+
39+
In this example, the element is skewed horizontally by 30deg:
40+
41+
```css
42+
.box {
43+
width: 50px;
44+
height: 60px;
45+
background-color: red;
46+
transform: skewX(30deg);
47+
}
48+
```
49+
50+
The output of the code above is shown below:
51+
52+
![A box element skewed 30 degrees along the x-axis by CSS skewX function](https://raw.githubusercontent.com/Codecademy/docs/main/media/css-transform-skewX-1.jpg)
53+
54+
## Example 2: Skewing by Turns
55+
56+
In this example, the element is skewed horizontally by `-0.2turn`:
57+
58+
```css
59+
.box {
60+
width: 50px;
61+
height: 60px;
62+
background-color: red;
63+
transform: skewX(-0.2turn);
64+
}
65+
```
66+
67+
The output of the code above is shown below:
68+
69+
![A box element skewed -0.2 turns along the x-axis by CSS skewX function](https://raw.githubusercontent.com/Codecademy/docs/main/media/css-transform-skewX-2.jpg)

media/css-transform-skewX-1.jpg

4.92 KB
Loading

media/css-transform-skewX-2.jpg

9.17 KB
Loading

0 commit comments

Comments
 (0)