Blog, Website & Page Publishing

bstock98
参加者

@import Google Font not working within css files

解決

Hey there Everyone,

 

I am trying to add a different font to the css stylesheets attached to the website I'm designing and I can't seem to get a new google font to import with the URL link and font-family reference.

 

Would anyone be able to show me what I'm doing wrong here?

 

This is the import link in the first stylesheet:

 

@import url('https://fonts.googleapis.com/css2?family=Raleway:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700...

 

Here is the font-family reference:

 

font-family: 'Raleway', sans-serif; /* 1 */
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
}

 

If you need anymore info to help me clarify this, please let me know.

 

As always your help is greatly appreciated.

 

Ben S.

0 いいね!
1件の承認済みベストアンサー
Ben_M
解決策
キーアドバイザー

@import Google Font not working within css files

解決

You have an issue in your starter.css file.  CSS renders based on order of operation, so since it is included after reset it is superceding it.  In starter.css,  line 6252 there is a CSS for the body tag that reads:

 

font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"

 

When you take out that line the reset css file that you have begins showing the Raleway font again.

元の投稿で解決策を見る

4件の返信
Ben_M
キーアドバイザー

@import Google Font not working within css files

解決

We are going to need to see the page in question or a test page that you can publish.  There is nothing wrong with the code itself that you published, but there could be an error on the page preventing the code from working as expected.

bstock98
参加者

@import Google Font not working within css files

解決

Thank you for responding,

 

Here is a link to the preview of the page:

https://www.signumbiosciences.com/hyvia-home?hs_preview=YKLHlbjt-27438858245

 

Ben S.

0 いいね!
Ben_M
解決策
キーアドバイザー

@import Google Font not working within css files

解決

You have an issue in your starter.css file.  CSS renders based on order of operation, so since it is included after reset it is superceding it.  In starter.css,  line 6252 there is a CSS for the body tag that reads:

 

font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"

 

When you take out that line the reset css file that you have begins showing the Raleway font again.

bstock98
参加者

@import Google Font not working within css files

解決

Ben,

 

Thank you so much! That fixed it all. I appreciate the help.


Ben S.

0 いいね!