Tailwind CSS Skew
The skew utility class in Tailwind CSS allows you to apply skew transformations to elements.
Tailwind Skew
The skew utility class in Tailwind CSS allows you to apply skew transformations to elements. Skewing is a transformation that tilts or slants an element along either the horizontal or vertical axis, giving it a unique visual effect.
Applying Skew Transformations
To apply a skew transformation to an element, you can use the skew-{value}
utility class, where {value}
represents the desired angle of skewing. The available values range from -180 to 180, allowing you to skew elements in both positive and negative directions.
Here's an example:
<div class="skew-y-0"> <!-- Content here --></div><div class="skew-x-12"> <!-- Content here --></div><div class="skew-y-12"> <!-- Content here --></div>
Preview
Responsive Skew Transformations
Tailwind CSS allows you to apply skew transformations responsively at different breakpoints. To use responsive skew classes, you can append the breakpoint prefix to the utility class. For example, md:skew-x-4 applies a skew transformation to the element along the horizontal axis starting from the medium breakpoint and above.
<div class="skew-x-4 md:skew-x-0"> <!-- Content here --></div>
In the above example, the element is initially skewed by 4 degrees along the horizontal axis with the skew-x-4
class, but starting from the medium breakpoint and above, it returns to its original skew angle using the skew-x-0
class.
Combining Skew Transformations
You can combine skew transformations with other utility classes in Tailwind CSS to achieve more complex visual effects. For example, you can combine the skew class with the hover class to apply a skew transformation on hover:
<button class="transform skew-y-6 hover:skew-y-0"> <!-- Button content here --></button>
In the above example, the button is initially skewed by 6 degrees along the vertical axis, but when hovered over, it returns to its original skew angle.
Tailwind Skew Class Table
Class | Properties |
---|---|
skew-x-0 | --tw-skew-x: 0deg; |
skew-x-1 | --tw-skew-x: 1deg; |
skew-x-2 | --tw-skew-x: 2deg; |
skew-x-3 | --tw-skew-x: 3deg; |
skew-x-6 | --tw-skew-x: 6deg; |
skew-x-12 | --tw-skew-x: 12deg; |
-skew-x-12 | --tw-skew-x: -12deg; |
-skew-x-6 | --tw-skew-x: -6deg; |
-skew-x-3 | --tw-skew-x: -3deg; |
-skew-x-2 | --tw-skew-x: -2deg; |
-skew-x-1 | --tw-skew-x: -1deg; |
skew-y-0 | --tw-skew-y: 0deg; |
skew-y-1 | --tw-skew-x: 1deg; |
skew-y-2 | --tw-skew-x: 2deg; |
skew-y-3 | --tw-skew-x: 3deg; |
skew-y-6 | --tw-skew-x: 6deg; |
skew-y-12 | --tw-skew-y: 12deg; |
-skew-y-12 | --tw-skew-y: -12deg; |
-skew-y-6 | --tw-skew-x: -6deg; |
-skew-y-3 | --tw-skew-x: -3deg; |
-skew-y-2 | --tw-skew-x: -2deg; |
-skew-y-1 | --tw-skew-x: -1deg; |
Windframe Tailwind blocks
Windframe is a drag and drop builder for rapidly building tailwind css websites and UIs