在PHP文件中不应用TailwindCSS样式的类

sirbozc5  于 2022-12-10  发布在  PHP
关注(0)|答案(2)|浏览(109)

TailwindCSS样式表被页面代码正确地检测到了,但是尽管如此,类名并没有应用样式。我已经把它复制到TailwindCSS Playground中,看看它是否在那里工作,它确实工作了,所以我不知道为什么它在这里不工作。
页码:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Exceptional Kids | Login</title>
        <link href="../style.css" rel="stylesheet">
    </head>
    <body>
        <div class="flex justify-center items-center h-screen">
            <div class="border-4 border-black rounded-3xl flex justify-around p-10">
                <div class="text-center border-r-2">
                    <p class="text-xl font-bold">Login</p>
                    <form action="/api/login" method="post" class="px-5">
                        <div>
                            <label for="email">Email: </label>
                            <input type="email" name='email' class="shadow-md mx-4 my-2" /><br />
                        </div>
                        <div>
                            <label for="password">Password: </label>
                            <input type="password" name='password' class="shadow-md mx-4 my-2" /><br />
                        </div>
                        <input type="submit" value='Login' class="border-2 p-1 my-5 rounded-md" />
                    </form>
                </div>
                <div class="text-center border-l-2">
                    <p class="text-xl font-bold">Sign Up</p>
                    <form action="/api/signup" method="post" class="px-5">
                        <div>
                            <label for="firstName">Enter name of parent/guardian: </label>
                            <input type="text" name='firstName' class="shadow-md mx-4 my-2" /><br />
                        </div>
                        <div>
                            <label for="lastName">Enter name of parent/guardian: </label>
                            <input type="text" name='lastName' class="shadow-md mx-4 my-2" /><br />
                        </div>
                        <div>
                            <label for="email">Enter parent/guardian&apos;s email: </label>
                            <input type="email" name='email' class="shadow-md mx-4 my-2" /><br />
                        </div>
                        <div>
                            <label for="password">Enter password: </label>
                            <input type="password" name='password' class="shadow-md mx-4 my-2" /><br />
                        </div>
                        <input type="submit" value='Create Account' class="border-2 p-1 my-5 rounded-md" />
                    </form>
                </div>
            </div>
        </div>
    </body>
</html>

TailwindCSS配置文件:

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: ["./src/**/*.{html,php}"],
  theme: {
    extend: {},
  },
  plugins: [],
}
bttbmeg0

bttbmeg01#

我当时面对同样的问题做了如下的处理:
将此=〉替换为此=〉
你只需要在style.css后面加上“?”,即style.css?
希望这对你有用!

4sup72z8

4sup72z82#

第一次运行
npm运行监视
然后刷新页面

相关问题