Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

Set a google fonts to quark theme

Solved by pamtbaau View solution

Started by Dave Torchia 8 years ago · 2 replies · 3142 views
8 years ago

Hi, how can I change the font of quark theme with a google fonts? I use windows OS... Thank you so much...

8 years ago Solution

@semplicewebsite There are several ways of doing it, these are just two of them.

Option 1: Using @import in css:

  • I presume you already know your way in Google Fonts to find the @import statement.
  • Create a child theme inherited from Quark if not already
  • Create file '/user/themes/mytheme/css/custom.css' or use your existing css file and add:

    CSS
    @import url('https://fonts.googleapis.com/css?family=Open+Sans');
    
    body {
     font-family: 'Open Sans', sans-serif;
    }
    

    Note: If you don't want to use a child theme, you can insert above code into 'user/themes/quark/css/custom.css'.

Option 2: Using <link> in template:

  • I presume you already know your way in Google Fonts to find the <link> statement.
  • Create a child theme inherited from Quark if not already
  • Copy '/user/themes/quark/templates/partials/base.html.twig' from Quark to your theme: '/user/themes/mytheme/templates/partials/
  • Paste the link in template 'base.html.twig':
    TWIG
    {{ assets.css() }}
    <link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
    
  • Create file '/user/themes/mytheme/css/custom.css' or use your existing css file and add:
    CSS
    body {
    font-family: 'Open Sans', sans-serif;
    }
    

If you want to know which one is better, you're not the first to ask: @import vs link

Almost forgot... If you want to store the fonts on your server, you might find a solution in this reply and further down in a similar topic..

If you have any questions, don't hesitate to ask...

👍 1
last edited 08/27/18 by pamtbaau
8 years ago

@pamtbaau:
Note: If you don’t want to use a child theme, you can insert above code into ‘user/themes/quark/css/custom.css’.

Thank you...it works!!! You are so gentle...and generous...
MI

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 125 19 hours ago
General · by pamtbaau, 1 day ago
1 89 24 hours ago
General · by Andy Miller, 2 days ago
0 73 2 days ago
General · by Marcel, 12 months ago
6 382 5 days ago
General · by Duc , 6 days ago
3 69 6 days ago