Jump to content

Custom Font Only Displaying When in CSS Editor

Go to solution Solved by Ziggy,

Recommended Posts

Hello! I'm trying to add two custom fonts to a site I'm working on and it displays properly when I'm in the CSS editor. However, when I exit it's showing a default serif font. Any ideas what the issue could be? 

 

/* H3 Custom Font - Play Regular */
@import url('https://fonts.googleapis.com/css?family=Play&display=swap');
@font-face {font-family: 'Play', web-safe-alternative;}
h3{font-family: 'Play' !important}

/* H4 Custom Font - Play Bold */
@import url('https://fonts.googleapis.com/css?family=Play:wght@400;700&display=swap');
@font-face {font-family: 'Play', web-safe-alternative;}
h4{font-family: 'Play' !important}

Link to comment
  • Replies 2
  • Views 263
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

  • Solution

I believe that you need to have the @import in the header rather than in the CSS, add this to Header Code Injection:

<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=Play:wght@400;700&display=swap" rel="stylesheet">

image.png.eb93da1cdb7847d598c84baef9bef5e9.png

Please like and upvote if my comments were helpful to you. Cheers!

Zygmunt Spray
Squarespace Website Designer
Contact me: 
https://squarefortytwo.com 
Hire me on Upwork!

🔌 Ghost Squarespace Plugins (Referral link)
📈 SEO Space (Referral link)
 SquareWebsites Plugins (Referral link)
 🔲 SQSP Themes (Referral link) 
Spark Plugin (Referral link) 

 Did I help? Buy me a coffee?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.