6/11/24, 6:34 PM php - CSS not loading in Laravel 5.
2 - Stack Overflow
2024 Developer survey is here and we would like to hear from you! Take the 2024 Developer Survey
CSS not loading in Laravel 5.2
Asked 7 years, 11 months ago Modified 7 years, 11 months ago Viewed 496 times Part of PHP Collective
Situation:
I'm creating a web application using Laravel, but for the moment CSS that i created aren't
0
loading.
Folder Structure
Laravel Version
https://stackoverflow.com/questions/37987098/css-not-loading-in-laravel-5-2?rq=3 1/3
6/11/24, 6:34 PM php - CSS not loading in Laravel 5.2 - Stack Overflow
Laravel Framework version 5.2.36
master.blade.php code
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>@yield('title')</title>
<link rel ="stylesheet" href= "{{ URL::secure('src/css/main.css') }}">
@yield('styles')
</head>
<body>
@include('includes.header')
<div class="main">
@yield('content')
</div>
</body>
</html>
php html css laravel laravel-5
Share Improve this question Follow asked Jun 23, 2016 at 9:09
AVI
5,645 5 29 40
Why is there a src folder in your public folder? – tkausl Jun 23, 2016 at 9:11
Is it loading with asset like so <link rel ="stylesheet" href= "{{
URL::asset('src/css/main.css') }}"> ? – linuxartisan Jun 23, 2016 at 9:11
2 Answers Sorted by: Highest score (default)
Write like this:
5 <link rel ="stylesheet" href= "{{ asset('src/css/main.css') }}">
Share Improve this answer Follow answered Jun 23, 2016 at 9:12
Arnab Rahman
1,013 1 9 15
https://stackoverflow.com/questions/37987098/css-not-loading-in-laravel-5-2?rq=3 2/3
6/11/24, 6:34 PM php - CSS not loading in Laravel 5.2 - Stack Overflow
Another alternative:-
3 <link rel="stylesheet" href="{{ url('/') }}./src/css/main.css" type="text/css"/>
Share Improve this answer Follow answered Jun 23, 2016 at 9:16
Ravi Hirani
6,479 1 29 42
https://stackoverflow.com/questions/37987098/css-not-loading-in-laravel-5-2?rq=3 3/3