Styles
Styles are key to creating dynamic and responsive designs in Webflow.
In the Designer, you can manage style changes through Classes. In the Webflow API, these Classes are Style Objects - with distinct CSS properties - that can be applied to an element. The methods described below give you direct control over which styles are applied to elements, letting you change a page’s appearance and layout as needed. To directly manage CSS properties within a Style Object, use the Style Methods.
Methods
element.getStyles()
Retrieve the current style properties of the element for analysis or changes.
Syntax
Returns
Promise<Style>
A Promise that resolves to an array of Style Objects.
Example
Designer Ability
Checks for authorization only
element.setStyles(styles)
Set styles on an element.
Syntax
Parameters
Styles
: Array of Style Objects - The array of styles to set.
Returns
Promise<null
>
A Promise that resolves to null
.