Home > Enterprise >  passing argument through css
passing argument through css

Time:12-25

So I have a code which looks like this:

<div className="site-col-1">
   content 1
</div>
<div className="site-col-2">
  content 2
</div>

And the css file looks like this...

.site-col-1 {
    grid-column: span 1;
}

.site-col-2 {
    grid-column: span 2;
}

.site-col-3 {
   grid-column: span 3;
}

Is there a way to just pass the number as an argument from the div rather than have a long css file. Something along these lines:

.site-col-ARG {
  grid-column: span ARG
}

CodePudding user response:

You may use enter image description here

  • Related