Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions content/css/concepts/transform-functions/terms/skewX/skewX.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
Title: 'skewX()'
Description: 'Skews an element horizontally by a specified angle using the CSS transform property.'
Subjects:
- 'Web Design'
- 'Web Development'
Tags:
- 'Functions'
- 'Positioning'
CatalogContent:
- 'learn-css'
- 'paths/front-end-engineer-career-path'
---

**`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.

## Syntax

```pseudo
transform: skewX(<value>);
```

**Parameters:**

- `<angle>`: Specifies the skew amount. Accepts any valid CSS angle unit:
- Degrees (`deg`)
- Radians (`rad`)
- Gradians (`grad`)
- Turns (`turn`)

The value may be positive or negative.

**Return value:**

None. This function produces a transform value that modifies the element’s rendering when applied through the `transform` property.

## Example 1: Skewing by Degrees

In this example, the element is skewed horizontally by 30deg:

```css
.box {
width: 50px;
height: 60px;
background-color: red;
transform: skewX(30deg);
}
```

The output of the code above is shown below:

![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)

## Example 2: Skewing by Turns

In this example, the element is skewed horizontally by `-0.2turn`:

```css
.box {
width: 50px;
height: 60px;
background-color: red;
transform: skewX(-0.2turn);
}
```

The output of the code above is shown below:

![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)
Binary file added media/css-transform-skewX-1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/css-transform-skewX-2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.