0

Custom font isn't loading on my website. Can someone help? I can't seem to get the @font-face to work and it looks right.

@font-face {
  font-family: 'AppleGaramond';
   src: url('fonts/AppleGaramond-BoldItalic.ttf') format('truetype');
   src: url('fonts/applegaramond-bolditalic-webfont.woff') format('woff'),
   src: url('fonts/applegaramond-bolditalic-webfont.woff2') format('woff2');
}

.h1, h1 {
    font-size: 3.1em;
    font-weight: 700;
    letter-spacing: .03em;
    line-height: 1.7em;
    font-family: 'AppleGaramond', serif;
    color: #161616;
}
6
  • @font-face { font-family: customFontsDIN; src: url(../fonts/open-sans/OpenSans-Regular.ttf); } try this Commented Jan 29, 2021 at 5:26
  • Can you share your folder structure? Commented Jan 29, 2021 at 5:27
  • /Documents/GitHub/website-2021/fonts Commented Jan 29, 2021 at 5:51
  • where you is your css file and /css folder in main root folder (website-2021)? Commented Jan 29, 2021 at 5:53
  • Does this answer your question? @font-face not working Commented Jan 29, 2021 at 5:54

1 Answer 1

1

I got it. I just had to add (..) before the /font. Double period (..) means you go up one folder and then look for the folder behind the slash.

@font-face {
  font-family: 'AppleGaramond';
   src: url('../fonts/AppleGaramond-BoldItalic.ttf') format('truetype');
   src: url('../fonts/applegaramond-bolditalic-webfont.woff') format('woff'),
   src: url('../fonts/applegaramond-bolditalic-webfont.woff2') format('woff2');
}

Thanks guys for helping me out!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.