Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github Pages font-face not working

I uploaded my project to Github pages and the font doesn't work! I've read other questions about the issue that lead me to think I need to change how I'm pointing the file, but I can't sort it out.

Here's my @font-face:

@font-face {
    font-family: headerFont;
    src: url(fonts/FreePixel.ttf);
}

Here's my file structure:

Portfolio/
    index.html
    css/
        styles.css
        fonts/
            FreePixel.ttf
like image 842
Rokitar Avatar asked Oct 28 '25 08:10

Rokitar


1 Answers

Try with a relative path, meaning starting with ./

src: url(./css/fonts/FreePixel.ttf);

That will check from which root folder GitHub page is considering that relative path.

Of course, that supposes the files are uploaded, and not (as it was the case) in the .gitignore file of the repo.

like image 66
VonC Avatar answered Oct 31 '25 11:10

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!