You are trying to apply css repeatedly while working in the pug template.

Asked 2 years ago, Updated 2 years ago, 110 views


    -for(var i = 0; i<10; i++)
            style.
            #sum+i{
                background-color:green;
            }

Working in pug, you want to apply CSS repeatedly to elements with IDs sum0, sum1, sum2,... sum9. What's the problem?

pug css

2022-09-22 18:21

1 Answers

There was a problem with how to interpolate (insert variables). DEMO

- for (var i = 0; i < 10; i++)
  style.
    #sum#{i} {
      background-color: green;
    }
p#sum3 foo bar

+ It is recommended to use the class if possible for styling that should be repeatedly applied.


2022-09-22 18:21

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.