Sign in

.getStyle()

Fetches and returns a computed/current style property of an element.

Syntax

neon.getStyle(string style)

style

The name of the style property to query.

Requirements

This method should be executed on a selection of elements. Please see the .select() method. Note that only the first element is used if there are multiple selected elements.

Return value

Returns a string containing the computed/current value of the given style property, or undefined if this information is unavailable.

This method is not chainable.

Description

This method can be used to determine the computed or current value of a style property on the selected element.

This not only includes style properties which have been set inline, but also those set by stylesheets and (in many cases) those set by the browser as default styles.

Please note that the resulting value may be returned in a number of different formats on different browsers and Neon does not attempt to normalise these. For example, the same color may be returned as "yellow", "rgb(255,256,0)" or "#ffff00" in different situations. In some browsers, this depends on how the style was originally set.

To get the dimensions or location of an element in pixels, see .getPosition().