style
Edit this pageSolid's style attribute lets you provide either a CSS string or an object where keys are CSS property names:
Unlike React's style attribute, Solid uses element.style.setProperty under the hood. This means you need to use the lower-case, dash-separated version of property names instead of the JavaScript camel-cased version, such as background-color
rather than backgroundColor
. This actually leads to better performance and consistency with SSR output.
This also means you can set CSS variables! For example: