const scaled = CSS.px(10).mul(2, 3);
console.log(scaled.toString()); // "60px"
const numbers = CSS.number(2).mul(3);
console.log(numbers.toString()); // "6"CSSNumericValue: mul() method / notebook
CSSNumericValue: mul() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const area = CSS.px(2).mul(CSS.px(3));
console.log(area.toString()); // "calc(2px * 3px)"
console.log(JSON.stringify(area.type())); // '{"length":2}'
const mathProduct = CSS.px(23)
.mul(CSS.percent(4))
.mul(CSS.cm(3))
.mul(CSS.in(9));
console.log(mathProduct.toString()); // "calc(23px * 4% * 3cm * 9in)"const percentageLength = CSS.percent(50).add(CSS.px(10));
const percentageAngle = CSS.percent(50).add(CSS.deg(10));
try {
percentageLength.mul(percentageAngle);
} catch (e) {
console.log(e instanceof TypeError); // true
}