Next.js Discord

Discord Forum

i have a problem in tailwind with next js

Answered
gamy22 posted this in #help-forum
Open in Discord
i write this code but col-span not work

11 Replies

American black bear
TailwindCSS cannot read dynamic classes as it removes all unused classes from the bundle to make it as performant as possible
If you want to use dynamic classes you can do something like described here
Answer
thanks alot
i will try it
 // Map cols number to Tailwind grid classes
  const gridCols = {
    1: "grid-cols-1",
    2: "grid-cols-2",
    3: "grid-cols-3",
    4: "grid-cols-4",
    5: "grid-cols-5",
    6: "grid-cols-6",
  }[cols];
American black bear
<div style={{gridTemplateColumns: 3}}></div>
// or whatever the key is for grid cols
@American black bear tsx <div style={{gridTemplateColumns: 3}}></div> // or whatever the key is for grid cols
Rose-breasted Grosbeak
gridTemplateColumns lol. forgetting CSS because of TW?
@Rose-breasted Grosbeak `gridTemplateColumns` lol. forgetting CSS because of TW?
American black bear
what matters is the basics, syntax will change infinitely many times :D