CKTIS / CSS
skewY(): vertical shear and composition order
Make the vertical offset depend on horizontal position and see why two shears do not commute.
Version: CSS Modules
Syntax
transform: skewY(45deg);The function skewY() accepts one angle or unitless zero. Relative to the transform origin, it leaves x unchanged and computes y′ = y + x × tan(a). At 45 degrees a point with positive x moves down in normal CSS screen coordinates; a negative angle reverses that offset. Unlike a rotation, this shear does not preserve every angle or length.
Combining horizontal and vertical shears requires attention to order. For a local point, the rightmost function in a transform list acts first. Swapping skewX() and skewY() generally changes the result; neither composition should be confused with the older two-argument skew() function. The pivot is controlled by transform-origin, and the visible deformation does not resize the normal-flow layout box.
The example starts from the point 10,20 and a top-left origin. Positive and negative 45-degree vertical shears give 10,30 and 10,10. The written X-then-Y list gives 40,30, while its reverse gives 30,50. A 100×50px box becomes visually 100×150px under the single positive vertical shear, with its layout dimensions unchanged. These are matrix and rectangle measurements, not animation timing results.
Examples
const box = document.createElement('div');
box.style.cssText = 'width:100px;height:50px;transform-origin:0 0';
document.body.append(box);
function point(value) {
box.style.transform = value;
const p = new DOMMatrix(getComputedStyle(box).transform).transformPoint(new DOMPoint(10,20));
return [p.x,p.y].map(n => Number(n.toFixed(6))).join(',');
}
console.log('+45:', point('skewY(45deg)'));
console.log('-45:', point('skewY(-45deg)'));
console.log('X Y list:', point('skewX(45deg) skewY(45deg)'));
console.log('Y X list:', point('skewY(45deg) skewX(45deg)'));
box.style.transform = 'skewY(45deg)';
const r = box.getBoundingClientRect();
console.log('visual:', Math.round(r.width), Math.round(r.height));
console.log('layout:', box.offsetWidth, box.offsetHeight);
box.remove();Result
+45: 10,30 -45: 10,10 X Y list: 40,30 Y X list: 30,50 visual: 100 150 layout: 100 50
The order labels describe the written list, not chronological application to a point. Origin zero avoids confusing the separately applied pivot translations with the coefficients of the computed matrix.