Build css, a small helper modeled on jQuery's .css() method, for reading and writing an element's inline styles. The same function name does three different jobs depending on how you call it: pass just a property name to read its current value, pass a name and a value to set one property, or pass an object to set several at once. Setting returns the element so calls can be chained; reading returns the value.
function css(el: HTMLElement, prop: string): string; // GET one
function css(el: HTMLElement, prop: string, value: string): HTMLElement; // SET one
function css(el: HTMLElement, props: Record<string, string>): HTMLElement; // SET many
Work only with inline styles (el.style) — never computed styles or stylesheet rules.
const el = document.createElement('div');
css(el, 'color', 'red'); // sets el.style.color, returns el
css(el, 'color'); // → 'red' (reads the inline value)
css(el, 'margin'); // → '' (unset → empty string)
// Object form sets several at once and returns the element, so calls chain:
css(el, { color: 'blue', margin: '0px' });
css(css(el, 'color', 'green'), 'padding', '4px');
'' (empty string), not undefined or null.el so you can chain further calls.el.style for both reading and writing. Do not reach for getComputedStyle or stylesheet rules.