Join the Webstudio community

Updated 2 months ago

Binding for CSS styling.

At a glance

The community members discuss the possibility of binding CSS properties to data, such as setting the font size of a text field based on a value from a CMS. One community member tried to use the "style" attribute but was unsuccessful, and they also expressed uncertainty about adding CSS directly in a value field. The community members agree that it would be better to bind CSS properties in the Style Panel rather than the Settings Panel, as the latter is more related to data. However, there is no explicitly marked answer in the comments.

Just like it's possible to hide an element based on data binding, would it be possible to do binding for CSS?
Let's say in my CMS I have an option to select the font size of a text field, I would like to send the information (in number, like 14, 16, 24 etc..) to Webstudio to display the text with that font size.
Attachment
Screenshot_2024-08-07_082844.png
M
N
2 comments
I tried and it seems not possible right now. I tried with "style" attribute but I cannot add it (don't know why @TrySound?). But even if it would be possible, I'm not sure it would be possible to add css in the Value field...

It could be great to add biding for CSS indeed. But it would be better to bind them in the Style Panel instead of the Settings Panel (which is more related to datas).
Yes totally agree that it should be directly in the Style Panel!
Add a reply
Sign up and join the conversation on Discord