Can I loop while defining a style? #18941
-
|
I am adding this to a It is also possible to add the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
No, there is no looping with CSS. Assuming the <tr class="app-task-progress-50" style="--progress: 50%">
<td class="first:after:w-(--progress)">Otherwise, you could define a @utility app-task-progress-* {
td:first-child::after {
width: calc(--value(integer) * 1%);
}
}
@source inline("app-task-progress-{0..100..5}"); |
Beta Was this translation helpful? Give feedback.
-
|
So, in the case of Additionally, you can use a modifier, like in Related examples for functional utilities:
To include all classes in the code without using them, you can use
Specifically, for your example, Wongjn's answer is the best. |
Beta Was this translation helpful? Give feedback.

No, there is no looping with CSS.
Assuming the
app-task-progress-*class is added dynamically, I'd suggest using astyleattribute alongside to set a CSS variable like:Otherwise, you could define a
@utilitywith@source inlineto emulate a loop: