Adding custom fonts to GitHub pages

你说的曾经没有我的故事 提交于 2019-11-29 14:09:57
FSocko

I had this problem as well. I had fonts working properly locally, but couldn't seem to get it right on GitHub.

I figured out how to do this: The root of the gitHub.io page appears to be different than the local root directory, which leads to fonts in the wrong folder.

This is my code:

@font-face {
    font-family: F16;
    src: url("../SubSkipper/F16_Panel Font.ttf") format('truetype');
    font-weight: bold;
    font-style: normal;
}

SubSkipper is the name of my project and the .ttf font is in the apparent root directory what I mean by this is: "SubSkipper/" .

The path ../ goes back one level, then opens the root directory (SubSkipper) of the project as it appears locally.

The stylesheet file is located at https://you.github.io/assets/css/style.css when using just a markdown as the index, or README.md as the index. This is wooden-utensil's one using the Cayman theme, if you want to add custom css, I guess you can add to that file, just keep the existing code because then the Cayman or another theme won't work. Anyways I guess just add the

body {
    font-family: etc;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!