You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Laravel项目中Tailwind CSS样式不显示问题求助

Laravel自定义Tailwind样式不生效问题

问题重现步骤

  • 执行composer create-project laravel/laravel testcssproject创建Laravel新项目;
  • 在默认视图文件resources/views/welcome.blade.php的指定段落下方添加带Tailwind样式的段落:<p class="text-8xl font-bold text-red-500">这段文字应该是大字号、加粗、红色</p>;
  • 浏览器中该段落仅显示纯文本,无对应样式,但默认视图自带的Tailwind样式能正常生效。

已尝试的无效解决方案

  • 执行php artisan view:clear等缓存清理命令,重启服务器并强制刷新页面,问题依旧;
  • 执行npm run dev编译资源,无效果;
  • 安装Breeze扩展包后,登录/注册选项正常显示,但目标段落仍无样式。

Tailwind配置文件

const defaultTheme = require('tailwindcss/defaultTheme');

/** @type {import('tailwindcss').Config} */
module.exports = {
    content: [
        './vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
        './storage/framework/views/*.php',
        './resources/views/**/*.blade.php',
    ],

    theme: {
        extend: {
            fontFamily: {
                sans: ['Figtree', ...defaultTheme.fontFamily.sans],
            },
        },
    },

    plugins: [require('@tailwindcss/forms')],
};

内容的提问来源于stack exchange,提问作者Geoff L

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.28 10:55:04