Overview
The Styles APIs enable Apps to customize the look and feel of Elements, helping designers create consistent and responsive pro websites. Styles, also referred to as Classes in the Designer, save styling information that applies to as many elements as you want across a site.
In this overview, we’ll cover how to create styles, use CSS to adjust their look and feel through style properties, and apply styles to multiple elements throughout a page.
Creating a style
To create a style, you just need to give it a unique name. The Webflow API will not allow you to create a style with the same name as another.
Combo Class creation is not currently supported.
The Designer APIs currently offer read-only access to Combo Classes.
Adding style properties
To manage the look and feel of a style, you can adjust its style properties, which are the CSS properties used to define the appearance and formatting of elements on a web page. Refer to this list of Style Properties for a full index of properties that can be set on a style in Webflow.
You can add properties to a style in two ways:
setProperty(prop, value, options?)
- This method requires you to pass a single property name and its corresponding value asstring
parameters. Additionally, you can include an optionaloptions
parameter, which we cover below.
Applying styles to elements
Applying a style to an element will allow the element to take on the characteristics and properties of a style, and once applied, reflect any changes that are made to the style. Using the Element methods, let’s apply a style to an element.