Edit this page

up.element up.element.style(element, propOrProps)
JavaScript function

Receives computed CSS styles for the given element.

If a property is not set, it will be returned as an empty string.

Examples

When requesting a single CSS property, its value will be returned as a string:

let value = up.element.style(element, 'font-size')
// value is '16px'

When requesting multiple CSS properties, the function returns an object of property names and values:

let value = up.element.style(element, ['font-size', 'margin-top'])
// value is { 'font-size': '16px', 'margin-top': '10px' }

Parameters

element Element
propOrProps string|Array

One or more CSS property names in kebab-case.

Return value

string|Object