The CSSUnitValue interface of the CSS Typed Object Model API represents values that contain a single unit type.

MDN Reference

interface CSSUnitValue {
    unit: string;
    value: number;
    add(...values: CSSNumberish[]): CSSNumericValue;
    div(...values: CSSNumberish[]): CSSNumericValue;
    equals(...value: CSSNumberish[]): boolean;
    max(...values: CSSNumberish[]): CSSNumericValue;
    min(...values: CSSNumberish[]): CSSNumericValue;
    mul(...values: CSSNumberish[]): CSSNumericValue;
    sub(...values: CSSNumberish[]): CSSNumericValue;
    to(unit: string): CSSUnitValue;
    toString(): string;
    toSum(...units: string[]): CSSMathSum;
    type(): CSSNumericType;
}
Hierarchy
Index

Properties

unit: string

The CSSUnitValue.unit read-only property of the CSSUnitValue interface returns a string indicating the type of unit.

MDN Reference

value: number

The CSSUnitValue.value property of the A double.

MDN Reference

Methods

  • Returns string

  • The toSum() method of the js-nolint toSum(units) - units - : The units to convert to.

    MDN Reference

    Parameters

    • ...units: string[]

    Returns CSSMathSum