[Vuejs]-How to assign dynamic variables to CSS content in Vue.js?

1👍

In that case, you can directly use the following

<button :style="`letter-spacing: ${count}ch;`">

Here is a playground.

PS: :style is a shorthand for v-bind:style as explained here.


v-bind for CSS (mixing script + style) is also a thing.
Here, you’re only using script + template combo, so an interpolation is enough.

👤kissu

Leave a comment