Remove a style property

style.remove(prop, options?)

Remove a single style-property from a Style object.

Syntax

1style.removeProperty(prop: StyleProperty, options?: BreakpointAndPseudo): Promise<void>

Parameters

  • prop: StyleProperty - The name of the style property to set. See the style properties list for an index of CSS properties and their accepted value types.
  • options : BreakpointAndPseudo {breakpoint: BreakpointId, pseudo: PseudoStateKey?}- An optional parameter to filter properties based on a breakpoint and/or pseudo-class, also known as a pseudo-state.

    • BreakpointId: "xxl" | "xl" | "large" | "main" | "medium" | "small" | "tiny" - An optional identifier of the breakpoint size, also known as media query, in the Designer.
    • PseudoStateKey: "noPseudo" | "nth-child(odd)" | "nth-child(even)" | "first-child" | "last-child" | "hover" | "active" | "pressed" | "visited" | "focus" | "focus-visible" | "focus-within" | "placeholder" | "empty" | "before" | "after" - An optional identifier for the pseudo-classes of an element that can be targeted and styled using CSS.

Returns

Promise<void>

A Promise that resolves to undefined

Example

1removeSingleStyleProperty: async (property: StyleProperty) => {
2
3 // Get Selected Element
4 const selectedElement = await webflow.getSelectedElement()
5
6 if (selectedElement?.styles) {
7
8 // Get Element Styles
9 const styles = await selectedElement.getStyles()
10 const primaryStyle = styles[0]
11 await primaryStyle.removeProperty(property)
12
13 }
14},

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canModifyStyleBlocksAnyAnyCanvasDesign