Add CSS in Laravel 8

Viewed 11220

I put my CSS file inside public/css folder. I added CSS file in head section like below.

<link href="{{ url('/css/app.css') }}" rel="stylesheet">

But CSS is not working.

4 Answers

In Laravel 8, make sure your files are in the public folder and reference them like this:

<link rel="stylesheet" type="text/css" href="{{ url('css/app.css') }}">

This is working for me in Laravel 8 (make sure your files are in the public folder)

<link href="{{ asset('css/app.css') }}" rel="stylesheet">

I don't see why you can't just use a relative URL like:

<link href="./css/app.css" rel="stylesheet">

Below worked for me.

<link rel="stylesheet" type="text/css" href="{{ URL::to('css/app.css') }}">
Related