Jump to content

Custom CSS Font Styling Incorrectly on Different Browsers

Go to solution Solved by tuanphan,

Recommended Posts

Site URL: https://copper-violin-y56t.squarespace.com

Hi all,

So I've been constructing my new portfolio over the past couple days. I've been using Squarespace's custom CSS feature to style parts of my site, including the addition of a font called Inter (https://fonts.google.com/specimen/Inter).

However, after coding it all in using Microsoft Edge, I tested out the site using Chrome. Something weird happened; the Inter specific text appeared a lot thicker than what it should. I then tested the site using Firefox, the Inter specific text then appeared really thin in comparison. The portfolio using Microsoft Edge displays the site as it should look like, but the CSS font just seems to be having issues across alternative browsers (see attached screenshots - also see their naming conventions). I also tested the site using Safari for iOS, and the Inter font just didn't seem to persist at all, changing to a close sans-serif alternative.

Can anyone help me resolve this bug, please?

The way I have imported the inter font from Google is as follows:

@import url('https://fonts.googleapis.com/css?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap');

@font-face{font-family: 'Inter', sans-serif}

I have also tried importing using the alternative method, as follows (to no vail):

@font-face {    
font-family: 'Inter';       
src: url('https://fonts.googleapis.com/css?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap');}

I'm stumped, honestly. Any help would be greatly appreciated!

Kind Regards,

Elliot

Correct Font Styling using Microsoft Edge Version 95.0.1020.40.png

Incorrect Font Styling using Chrome version 95.0.4638.69.png

Incorrect Font Styling using Firefox version 94.0.1.png

Link to comment
10 hours ago, MrMinks said:

Site URL: https://copper-violin-y56t.squarespace.com

Hi all,

So I've been constructing my new portfolio over the past couple days. I've been using Squarespace's custom CSS feature to style parts of my site, including the addition of a font called Inter (https://fonts.google.com/specimen/Inter).

However, after coding it all in using Microsoft Edge, I tested out the site using Chrome. Something weird happened; the Inter specific text appeared a lot thicker than what it should. I then tested the site using Firefox, the Inter specific text then appeared really thin in comparison. The portfolio using Microsoft Edge displays the site as it should look like, but the CSS font just seems to be having issues across alternative browsers (see attached screenshots - also see their naming conventions). I also tested the site using Safari for iOS, and the Inter font just didn't seem to persist at all, changing to a close sans-serif alternative.

Can anyone help me resolve this bug, please?

The way I have imported the inter font from Google is as follows:

@import url('https://fonts.googleapis.com/css?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap');

@font-face{font-family: 'Inter', sans-serif}

I have also tried importing using the alternative method, as follows (to no vail):

@font-face {    
font-family: 'Inter';       
src: url('https://fonts.googleapis.com/css?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap');}

I'm stumped, honestly. Any help would be greatly appreciated!

Kind Regards,

Elliot

Correct Font Styling using Microsoft Edge Version 95.0.1020.40.png

Incorrect Font Styling using Chrome version 95.0.4638.69.png

Incorrect Font Styling using Firefox version 94.0.1.png

What is your site's password?

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Keyword Highlighter
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment
  • Solution

@MrMinks Try adding this to Settings > Advanced > Code Injection > Header

<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=Inter:wght@100;200;300;400;500;600;700;800;900&family=Montserrat:ital,wght@0,500;0,600;1,500;1,600&display=swap" rel="stylesheet">

If you use Personal Plan, you can edit Site Footer > Add a Code Block >> paste this code

<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=Inter:wght@100;200;300;400;500;600;700;800;900&family=Montserrat:ital,wght@0,500;0,600;1,500;1,600&display=swap" rel="stylesheet">

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
13 hours ago, tuanphan said:

@MrMinks Try adding this to Settings > Advanced > Code Injection > Header

<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=Inter:wght@100;200;300;400;500;600;700;800;900&family=Montserrat:ital,wght@0,500;0,600;1,500;1,600&display=swap" rel="stylesheet">

If you use Personal Plan, you can edit Site Footer > Add a Code Block >> paste this code

<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=Inter:wght@100;200;300;400;500;600;700;800;900&family=Montserrat:ital,wght@0,500;0,600;1,500;1,600&display=swap" rel="stylesheet">

 

Hi Tuanphan,

This seems to have worked! Thanks a bunch for this solution!

Just for future reference and acknowledgement, would you mind explaining briefly why this code fixed the issue?

Many thanks,

Elliot

Link to comment

@MrMinks When you choose font from Google Font, you missing style tag

And if you use @import approach you also need to add code to Code Injection, not Cusotm CSS

Here I used <link> code I usually use this way

 

ggfont.png

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

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.