Francisunoxx
Francisunoxx

Reputation: 1458

Link CSS file in blade file?

How can I properly link my css file in my blade file? I tried <link rel = "stylesheet" type = "text/css" href = "navigation.css"> but didn't work for me. I created a child page that contains navigation bar also a css file within in the same folder. So they're located under (partials) folder sub-folder of templates.

navigation.blade.php

<link rel = "stylesheet" href= "{{ URL::asset('assets/css/bootstrap.min.css')}}">

<div class = "navbar navbar-default">
<ul>
    <li>
        <a href = "#">Login</a>
        <a href = "#">Register</a>
    </li>
</ul>
</div>

navigation.css

.navbar-default
{
background-color: #7574bf;
}

Bootstrap library. SSH

Upvotes: 3

Views: 526

Answers (1)

Robin Dirksen
Robin Dirksen

Reputation: 3422

You need to add another <link> to your stylesheet. That will get your css file. (if it's on the same directory as bootstrap.min.css this will works)

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

So your code will be:

<link rel = "stylesheet" href= "{{ URL::asset('css/bootstrap.min.css')}}">
<link rel = "stylesheet" href= "{{ URL::asset('css/navigation.css')}}">

<div class = "navbar navbar-default">
<ul>
    <li>
        <a href = "#">Login</a>
        <a href = "#">Register</a>
    </li>
</ul>
</div>

Your folder structure:

public/css
public/images
public/fonts
public/js

Hope this works!

Upvotes: 2

Related Questions