layout - Laravel CSS not working when going to sub-links -
i beginner in laravel, , having trouble in laravel css layouts.
i have multiple links in web, example:
testing.com/main testing.com/aboutus testing.com/contactus
which used layout stored in /layouts/main.blade.php
in views folder.
inside layout, wrote css link based on public folder. ex:
<link href="stylesheet" href="/css/styles.css">
and works fine on links except ones sub-links, example:
testing.com/main/clients testing.com/main/solutions
the css seem have dissapear when navigate sub-links. not declaring css in laravel? css works when not sub-link.
you should use laravel helpers add assets views generate correct urls. either use url::asset('css/styles.css')
or asset('css/styles.css')
if need link arbitrary asset. alternatively, can bit cleverer , laravel hard lifting:
{{ html::style('css/site.css') }} {{ html::script('js/site.js') }} {{ html::image('images/logo.png') }}
these write html generating links assets.
Comments
Post a Comment