Home  >  Q&A  >  body text

What is the reason for Tailwind category failure?

<p>I first started using Tailwind and currently only use it with JavaScript. The first day, the class names all worked fine, but when I opened the project in VSCode the next day, only the Tailwind class name added before still worked. If I try to add more class names and designs to my HTML, nothing happens. </p> <p>For example, when I add <code>text-3xl</code> in the h2 tag, the text font size does not change. Also, if I add a new color to the text or add a background color, it doesn't take effect. </p> <p><strong>Link to all my code and files in Github</strong></p> <pre class="brush:php;toolbar:false;"><div class="flex flex-col md:w-1/2"> <h2 class="text-center text-3xl font-bold md:text-left">Track the overall progress of the company</h1> <p class="text-center md:text-left mt-4 mb-6">Understand how your daily tasks fit into the broader vision. Track progress from milestone level to the tiniest detail. Never lose sight of the bigger picture again. </p> </div></pre></p>
P粉011360903P粉011360903415 days ago505

reply all(1)I'll reply

  • P粉792026467

    P粉7920264672023-09-01 09:25:25

    Tailwind does not include all utility classes in the output CSS file. Instead, it parses out the classes you use in your code during the build process and adds only those classes to the output file.

    Therefore, if you add classes to your code, you need to re-run the build process, either manually or by including the --watch option in the build command. For example:

    npx tailwindcss -i ./src/input.css -o ./dist/output.css --watch

    Note: This is also why adding a previously unused utility class in the DOM inspector of the browser development tools does not immediately affect the page elements.

    reply
    0
  • Cancelreply