Udhayan Nair
Udhayan Nair

Reputation: 552

How to use custom fonts in Laravel's blade?

Basically, I have imported various custom font templates into my public/fonts folder. Examples are Muli, Muli-Bold, Muli-ExtraBold. My question now is, how do I call and use these fonts in my blade files?

Upvotes: 1

Views: 17277

Answers (2)

SourabhS
SourabhS

Reputation: 82

If you want to add custom font in lavarel you can add it just like you do in HTML file . You can add in css as:

    @font-face { 
font-family: Muli-Bold; src: url('/fonts/Muli-Bold.tff');
 }

Or you can include the above code in blade using the style tag.

Upvotes: 2

Dhananjay Kyada
Dhananjay Kyada

Reputation: 1036

You can add custom fonts in laravel as like you add in an HTML template. You can add it in blade like

<style type="text/css">
    @font-face {
        font-family: Muli-Bold;
        src: url('{{ public_path('fonts/Muli-Bold.tff') }}');
    }
</style>

And you can add it in any css file as :

@font-face {
    font-family: Muli-Bold;
    src: url('/fonts/Muli-Bold.tff');
}

Upvotes: 4

Related Questions