CSS Portal

skewX() CSS Function

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

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.

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);
}

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
-

Last updated by CSSPortal on: 31st December 2025

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!