@jossmac/lil-libs
    Preparing search index...

    Function getComputedStyle

    • Reads a computed style value from an element, including CSS custom properties.

      • element: HTMLElement | SVGElement

        HTML or SVG element whose computed styles to read.

      • name: string

        CSS property in camelCase (e.g. "lineHeight") or a custom property (e.g. "--space-10").

      The computed value as a string; custom properties use getPropertyValue, standard properties prefer direct CSSStyleDeclaration access.

      const el = document.createElement("div");

      getComputedStyle(el, "color"); // e.g. "rgb(0, 0, 0)"
      getComputedStyle(el, "lineHeight"); // e.g. "normal"
      getComputedStyle(el, "--space-10"); // "" until the custom property is set