简体   繁体   中英

Can't load CSS in Laravel

Hi I am currently learning Laravel and seem to be having issues loading custom CSS that is located in the public/css/bootstrap.css.

I have been attempting to load it via

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

But it is if the CSS is not getting picked up. When I view the page source ( http://portfollo.co.uk/css/bootstrap.css ) I just get an error. Any ideas ?

Try with public/css/bootstrap.css

 <link href="{{ asset('public/css/bootstrap.css') }}" rel="stylesheet" type="text/css" >

OR

<link href="'/css/bootstrap.css'" rel="stylesheet" type="text/css" >

You should put your css file inside public folder, (app/public): then in your head:

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

Public folder will contain all css and js files, you can also create assets folder inside public folder and then point to correct path:

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

change name as public/css/bootstrap.css and put css in that folder. and give the same path.

This is not a CSS error. its Routing error. check your route.php file just check your source code like this view-source:http://portfollo.co.uk/css/bootstrap.css

you are trying something wrong ??

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM