Jump to content

Change default font-family


Recommended Posts

I'm still trying to figure out why I can't integrate a Google font into my site via "custom.css". The font I want to use is "Creepster". So the lines I have added are as follows

@import url('https://fonts.googleapis.com/css2?family=Creepster&display=swap" rel="stylesheet');
body *{
  font-family: Creepster, cursive; !important
}

But it still doesn't work. Thank you for your help.

 

Link to comment
Share on other sites

Hello,

This code is working fine for me:

@import url('https://fonts.googleapis.com/css2?family=Creepster&display=swap');
body {
  font-family: Creepster, cursive;
}

 

Could contain: Text, Paper

If you're trying to use it on a 3rd party theme, post your URL here and I'll take a closer look for you 🙂

Link to comment
Share on other sites

16 minutes ago, opentype said:

Before assigning a new Google font, you need to turn off the Google fonts assigned in your theme settings.

This is already the case but you cannot see it because it is another theme that is a copy of the one displayed by default.  As I don't want my members to be able to access it now, it is only visible to the "administrator" group.

Link to comment
Share on other sites

3 hours ago, Olmyster said:

This is already the case but you cannot see it because it is another theme that is a copy of the one displayed by default.  As I don't want my members to be able to access it now, it is only visible to the "administrator" group.

We’ll need to view the broken/admin theme to find out why the font isn’t loading. 

Link to comment
Share on other sites

Your site is currently using this code:

@import url('https://fonts.googleapis.com/css2?family=Creepster&display=swap" rel="stylesheet');
body {
    font-family: Creepster, cursive;
}

It needs to be this:

@import url('https://fonts.googleapis.com/css2?family=Creepster&display=swap');
body {
    font-family: Creepster, cursive;
}

 

With that said, import statements should only appear at the very top of your css file. Depending on how your theme has been coded, the custom.css file can be appended to other files, which means that your import statement is no longer at the top.

A safer solution would be to use the <link> code. Add this to the <head> area of your theme:

<link rel="preconnect" href="https://fonts.googleapis.com"> 
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> 
<link href="https://fonts.googleapis.com/css2?family=Creepster&display=swap" rel="stylesheet">

Then use this in your css:

body {
    font-family: 'Creepster', cursive;
}

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...