style.removeProperties(prop, options?)
style.removeProperties(prop, options?)
Remove multiple style properties from a Style object.
Syntax
style.remove(props: Array<StyleProperty>,options?: BreakpointAndPseudo): Promise<void>
Parameters
- prop: StyleProperty [] - An array of style properties. 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.
- BreakpointId:
Returns
Promise<null
>
A Promise that resolves to null
Example
// Get Selected Element
const selectedElement = await webflow.getSelectedElement()
if (selectedElement?.styles) {
// Get Element Styles
const styles = await selectedElement.getStyles()
const primaryStyle = styles[0]
const properties : StyleProperty[] = ['background-color', 'accent-color',"font-family"]
await primaryStyle.removeProperties(properties)
}
Designer Ability
Designer Ability | Locale | Branch | Workflow | Sitemode |
---|---|---|---|---|
canModifyStyleBlocks | Any | Any | Canvas | Design |