Function getComputedPixels

Returns the computed measurements of CSS properties via getComputedStyle.

const v = getComputedPixels(`#some-el`, `borderTopWidth`, `borderLeftWidth`);
v.borderTopWidth; // number
b.borderLeftWidth; // number

Throws an error if value from getComputedStyle is not a string or does not end in 'px'.

  • Type Parameters

    • T extends readonly (keyof CSSStyleDeclaration)[]

    Parameters

    • elOrQuery: string | HTMLElement
    • Rest...properties: T

    Returns ComputedPixelsMap<T>