v0.20.230 - 8.3 / 6

style:__

Several ways to set inline styles on an element. Each form can be a plain value or a function/signal. To remove a style, set its value to null, undefined, or false.

# Forms

formwhat it does
style:color="red"namespace form — sets a single property (supports custom properties too: style:--brand="red")
style="color:red"string form — assigned to style.cssText, replacing any existing inline style
style={{ color: 'red' }}object form — each key becomes a single property set via style.setProperty
style="color:var(--color)"strings can reference CSS custom properties
style:my-ns={{ color: "red" }}nested object form — identical to the object form above; the my-ns part is ignored at runtime

# Object form caveat

When you swap the object on a style={...} binding, properties that were on the previous object but not on the new one are not removed. Clear them explicitly by setting the value to null.

# CSS Styles

Tests most of the ways