HTML Guides for transform
Learn how to identify and fix common HTML validation errors flagged by the W3C Validator — so your pages are standards-compliant and render correctly across every browser. Also check our Accessibility Guides.
The transform CSS property lets you rotate, scale, skew, or translate an element by modifying its coordinate space. The W3C validator raises this error when the value assigned to transform doesn’t conform to valid CSS syntax. This typically happens when:
- A transform function name is misspelled (e.g., rotateZ typed as rotatez in some contexts, or skew typed as skeew).
- Too many arguments are passed to a transform function (e.g., rotate(45deg, 20deg) instead of rotate(45deg)).
- Arguments are missing required units (e.g., rotate(45) instead of rotate(45deg)).
- Multiple transform functions are separated by commas instead of spaces.
- An invalid or non-existent function name is used (e.g., transform: flip()).
- Vendor-prefixed values like -webkit-transform syntax are used in the standard transform property incorrectly.
This matters for standards compliance because browsers may silently ignore an invalid transform declaration entirely, meaning none of your intended transformations will be applied. Catching these errors during validation helps prevent unexpected layout or visual issues.
Each transform function has a specific signature. For example, rotate() accepts exactly one angle value, translate() accepts one or two length/percentage values, and scale() accepts one or two numbers. Providing the wrong number or type of arguments triggers this error.
Examples
Incorrect: Comma-separated transform functions
Multiple transforms must be space-separated, not comma-separated.
<div style="transform: rotate(45deg), scale(1.5);">Transformed</div>
Correct: Space-separated transform functions
<div style="transform: rotate(45deg) scale(1.5);">Transformed</div>
Incorrect: Missing unit on rotation value
The rotate() function requires an angle unit such as deg, rad, grad, or turn.
<div style="transform: rotate(45);">Rotated</div>
Correct: Angle value with unit
<div style="transform: rotate(45deg);">Rotated</div>
Incorrect: Too many arguments in a function
The rotate() function accepts only one argument.
<div style="transform: rotate(45deg, 20deg);">Rotated</div>
Correct: Single argument for rotate()
If you need to rotate around a specific axis, use rotateX(), rotateY(), or rotateZ() instead.
<div style="transform: rotateZ(45deg);">Rotated on Z axis</div>
Incorrect: Misspelled or non-existent function
<div style="transform: roate(30deg) scaleX(2);">Transformed</div>
Correct: Properly spelled function names
<div style="transform: rotate(30deg) scaleX(2);">Transformed</div>
Incorrect: Using translate without units on non-zero lengths
<div style="transform: translate(50, 100);">Moved</div>
Correct: Length values with units
A value of 0 does not require a unit, but all other length values do.
<div style="transform: translate(50px, 100px);">Moved</div>
Valid Transform Functions Reference
Here are the commonly used transform functions and their expected arguments:
- translate(tx) or translate(tx, ty) — lengths or percentages
- translateX(tx), translateY(ty), translateZ(tz) — a single length/percentage
- scale(sx) or scale(sx, sy) — unitless numbers
- scaleX(sx), scaleY(sy), scaleZ(sz) — a single unitless number
- rotate(angle) — a single angle value (e.g., 45deg)
- rotateX(angle), rotateY(angle), rotateZ(angle) — a single angle
- skew(ax) or skew(ax, ay) — angle values
- skewX(ax), skewY(ay) — a single angle
- matrix(a, b, c, d, tx, ty) — exactly six unitless numbers
- matrix3d(...) — exactly sixteen unitless numbers
When combining multiple transforms, always separate them with spaces and verify each function’s name and argument count against the specification.
The transform CSS property lets you rotate, scale, skew, or translate an element by modifying its coordinate space. The validator checks inline and embedded CSS for correctness, and it will flag any value it doesn’t recognize as a valid transform value. Common mistakes include:
- Missing units on angles or lengths (e.g., rotate(45) instead of rotate(45deg))
- Typos in function names (e.g., rotatee(10deg) or tranlate(10px))
- Wrong value types (e.g., using a color or a plain number where a function is expected)
- Missing commas or parentheses in function arguments
- Using non-existent functions (e.g., flip(180deg) is not a valid transform function)
- Incorrect number of arguments (e.g., matrix() requires exactly 6 values)
This matters for standards compliance and predictable rendering. While browsers may silently ignore invalid transform values, the element simply won’t be transformed — which can lead to subtle layout bugs that are hard to track down. Catching these errors at validation time helps you fix them before they reach users.
Examples
Invalid: missing angle unit
The rotate() function requires a value with an angle unit like deg, rad, turn, or grad.
<div style="transform: rotate(45);">Rotated text</div>
Fixed: adding the angle unit
<div style="transform: rotate(45deg);">Rotated text</div>
Invalid: typo in function name
<div style="transform: tranlateX(10px);">Shifted text</div>
Fixed: correcting the function name
<div style="transform: translateX(10px);">Shifted text</div>
Invalid: using a non-transform value
A plain number or unrelated keyword is not a valid transform value.
<div style="transform: 200px;">Content</div>
Fixed: using a proper transform function
<div style="transform: translateX(200px);">Content</div>
Invalid: wrong number of arguments for matrix()
The matrix() function requires exactly six comma-separated numbers.
<div style="transform: matrix(1, 2, 3);">Content</div>
Fixed: providing all six arguments
<div style="transform: matrix(1, 0, 0, 1, 0, 0);">Content</div>
Valid transform values reference
Here is a summary of all valid transform functions and the keyword/global values:
<style>
/* Keyword value */
.no-transform { transform: none; }
/* Translate functions */
.move-a { transform: translate(12px, 50%); }
.move-b { transform: translateX(2em); }
.move-c { transform: translateY(3in); }
.move-d { transform: translateZ(2px); }
.move-e { transform: translate3d(12px, 50%, 3em); }
/* Rotate functions */
.spin-a { transform: rotate(0.5turn); }
.spin-b { transform: rotateX(10deg); }
.spin-c { transform: rotateY(10deg); }
.spin-d { transform: rotateZ(10deg); }
.spin-e { transform: rotate3d(1, 2, 3, 10deg); }
/* Scale functions */
.grow-a { transform: scale(2, 0.5); }
.grow-b { transform: scaleX(2); }
.grow-c { transform: scaleY(0.5); }
.grow-d { transform: scaleZ(0.3); }
.grow-e { transform: scale3d(2.5, 1.2, 0.3); }
/* Skew functions */
.lean-a { transform: skew(30deg, 20deg); }
.lean-b { transform: skewX(30deg); }
.lean-c { transform: skewY(1.07rad); }
/* Other functions */
.depth { transform: perspective(500px); }
.matrix-2d { transform: matrix(1, 0, 0, 1, 0, 0); }
.matrix-3d { transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
/* Multiple functions chained together */
.combo { transform: translateX(10px) rotate(10deg) translateY(5px); }
</style>
When troubleshooting this error, look at the specific value the validator reports as invalid. Compare it against the valid functions listed above, double-check spelling, ensure all arguments have correct units, and verify that parentheses and commas are properly placed.
Ready to validate your sites?
Start your free trial today.