Favorites

skewX() CSS Function

skewX()
CSS FunctionThis function is supported by all modern browsers.
Updated 21st November 2026

The skewX() transform function slants an element horizontally by an angle, such as skewX(15deg).

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.

Description

The skewX() CSS function is used to apply a 2D skew transformation along the horizontal (X) axis of an element, effectively slanting the element’s shape to the left or right while keeping its vertical dimensions unchanged. This transformation can create dynamic visual effects, such as angled text, tilted buttons, or creative card designs. Unlike transform properties like rotate() which rotate elements around a pivot point, skewX() specifically distorts the element along the X-axis based on the angle you provide. Positive angles tilt the element to the right, while negative angles tilt it to the left.

It is commonly used in combination with other transform functions such as skewY() or scale() to create more complex transformations. Additionally, it can be animated using transition or animation to produce smooth interactive effects.

For example, you might use it to tilt a div card slightly when hovered:

.card {
  transform: skewX(15deg);
  transition: transform 0.3s ease;
}

.card:hover {
  transform: skewX(0deg);
}

This creates a visually appealing effect where the card appears slanted initially and straightens when hovered, drawing attention to interactive elements.

The skewX() function is especially useful in modern UI design where subtle angles can add depth and dynamism without affecting layout flow, unlike transformations that modify size or rotation.

Interactive Demo

Transform
Demo Code
HTML Code
<div class="demo-area">
	<div class="demo-ghost"></div>
	<div class="demo-element">Transform</div>
</div>
CSS Code
.demo-area {
	position: relative;
	width: 300px;
	height: 190px;
	background: #f4f4f4;
	outline: 1px dashed #b0b0b0;
}
.demo-ghost, .demo-element {
	position: absolute;
	left: 100px;
	top: 55px;
	width: 100px;
	height: 80px;
	box-sizing: border-box;
}
.demo-ghost {
	border: 2px dashed #b0b0b0;
}
.demo-element {
	padding: 8px;
	background: rgb(247 37 133 / 85%);
	color: #fff;
	font-size: 14px;
	transform: skewX(0);
}

Syntax

skewX() = transform: skewX(<angle>);

Values

  • <angle>The angle is taken as the value. A positive value tilts to the left, a negative value to the right. A value of 0 leaves the element without distortion.

Example

<div class="container">
<div class="skew-box">
<p>SKEWED BOX</p>
</div>
</div>
/* Centering the example on the page */
.container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
}

/* The element being skewed */
.skew-box {
width: 200px;
height: 100px;
background-color: #3498db;
color: white;
display: flex;
justify-content: center;
align-items: center;
font-weight: bold;
border-radius: 8px;

/* Applying the skew */
transform: skewX(-20deg);

/* Adding a transition for a smooth hover effect later */
transition: transform 0.3s ease;
}

/* Reversing the skew on hover */
.skew-box:hover {
transform: skewX(20deg);
}
Open in editor

Browser Support

The following information will show you the current browser support for the CSS skewX() function. Hover over a browser icon to see the version that first introduced support for this CSS function.

This function is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.