Where to put css file in laravel project

笑着哭i 提交于 2021-02-04 17:08:49

问题


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:


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') }}" />



回答2:


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.




回答3:


  1. search for Public folder in laravel

  2. Create css folder(That contain stylesheet files of your project), javascript,and Images folder (contain images that you will use in your project).

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

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

and JS

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



回答4:


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

simply add this your blade.php file



来源:https://stackoverflow.com/questions/33988896/where-to-put-css-file-in-laravel-project

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!