Skip to main content

HTML Guide

CSS: X: One operand must be a number.

A CSS property in your HTML includes a calculation or expression where a required numerical value is missing.

This usually happens with properties that use functions like calc(), or arithmetic within CSS, where one of the operands is missing or not a valid number. Common cases include missing units or entirely omitting a value around operators like +, -, *, /.

For example, the following is invalid:

<div style="width: calc(100% - );"></div>

Here, the value after - is missing, so the validator cannot process a non-existent number. Every side of an operator in calc() must be a valid number with possible units.

Correct usage:

<div style="width: calc(100% - 50px);"></div>

Double-check all inline style attributes and your CSS files for incomplete calc() expressions, arithmetic operations, or similar syntax issues, and make sure every operand around an operator is a valid number (with units if required).

Learn more:

Related W3C validator issues