DiviArea.Utils.toPixel()

DiviArea.Utils.toPixel(value, unit, element)

Converts any CSS unit to pixels – at least any CSS unit that is available in Divi Areas.

Params

value int|float, required
The number to convert, e.g. 12 or 30.25
unit string, required
The unit which defines the value, e.g. “in” or “vw”.
element HTMLElement, optional
Optional. Element that defines the base for relative units like “em” or “%”.
Default: <code>document.body</code>

Returns

Integer that represents the pixel dimension of the input value.

Notes

No notes

Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Get in touch with us