Files
Compass/web/lib/util/css.ts
Martin Braquet ba9b3cfb06 Add pretty formatting (#29)
* Test

* Add pretty formatting

* Fix Tests

* Fix Tests

* Fix Tests

* Fix

* Add pretty formatting fix

* Fix

* Test

* Fix tests

* Clean typeckech

* Add prettier check

* Fix api tsconfig

* Fix api tsconfig

* Fix tsconfig

* Fix

* Fix

* Prettier
2026-02-20 17:32:27 +01:00

18 lines
406 B
TypeScript

export const getPixelHeight = (varname: string) => {
// Create a temporary element
const el = document.createElement('div')
el.style.cssText = `
position: absolute;
bottom: 0;
height: env(${varname});
visibility: hidden;
`
document.body.appendChild(el)
// Measure the computed pixel value
const value = parseFloat(getComputedStyle(el).height)
el.remove()
return value
}