在 Laravel 8 中添加 CSS
Add CSS in Laravel 8
我将 CSS 文件放在 public/css
文件夹中。我在头部部分添加了 CSS 文件,如下所示。
<link href="{{ url('/css/app.css') }}" rel="stylesheet">
但是 CSS 不工作。
我不明白为什么你不能只使用亲戚 URL 比如:
<link href="./css/app.css" rel="stylesheet">
下面对我有用。
<link rel="stylesheet" type="text/css" href="{{ URL::to('css/app.css') }}">
在 Laravel 8 中,确保您的文件位于 public 文件夹中并像这样引用它们:
<link rel="stylesheet" type="text/css" href="{{ url('css/app.css') }}">
我在 Laravel 8 中工作(确保您的文件在 public 文件夹中)
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
我将 CSS 文件放在 public/css
文件夹中。我在头部部分添加了 CSS 文件,如下所示。
<link href="{{ url('/css/app.css') }}" rel="stylesheet">
但是 CSS 不工作。
我不明白为什么你不能只使用亲戚 URL 比如:
<link href="./css/app.css" rel="stylesheet">
下面对我有用。
<link rel="stylesheet" type="text/css" href="{{ URL::to('css/app.css') }}">
在 Laravel 8 中,确保您的文件位于 public 文件夹中并像这样引用它们:
<link rel="stylesheet" type="text/css" href="{{ url('css/app.css') }}">
我在 Laravel 8 中工作(确保您的文件在 public 文件夹中)
<link href="{{ asset('css/app.css') }}" rel="stylesheet">