17

I have been searching for an answer to this question with no luck. This is my second day using laravel and I'm trying to create a custom 404 error page. I don't know where/how to include my .css file. Can someone please help me with this?

1

6 Answers 6

28

Place your css files inside public folder and use link tag in html document (or 404 template)

Example

<link rel="stylesheet" type="text/css" href="{{ url('/css/style.css') }}" />
Sign up to request clarification or add additional context in comments.

4 Comments

Thank you i am trying that right now. I am so happy for the fast response and so grateful.
You are welcome. I edited the post, take a look at example
thank you that worked for me im accepting when i can
url() is NOT the right way to achieve this... instead use asset().
12

The best way is using blade syntax with the laravel helper for what you need

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

this folder css or whatever you named it, must be placed inside your public folder.

1 Comment

THIS is the right way, not the accepted answer.
7
  1. Search for Public folder in Laravel.
  2. Create css folder (that contains stylesheet files of your project), javascript and Images folder (contains images that you will use in your project).

Go to layouts in app.blade.php file update html code using blade syntax:

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

and JS:

<script src="{{ asset('pickadate/lib/picker.js')}}"></script>

Comments

2

1. put your CSS file in directory [PUBLIC/CSS]
2. in your FileName.blade.php in file just write :

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

Note Again : Don't Write asset('public/css/article.css') this wrong

Comments

2

put it in your public file and the html tags in view then to connect them with the css use

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

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
1

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

simply add this your blade.php file

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.