2016-03-01 76 views
4

我刚刚在GitHub上托管了我的新网站。我使用有一些自定义的字体,这是我上传旁边的index.htmlstyle.css文件:将自定义字体添加到GitHub页面

enter image description here

字体代码:

@font-face { 
    font-family: "gogoiadeco"; 
    src: url('gogoia-deco-webfont.eot'); 
    src: url('gogoia-deco-webfont.eot?#iefix') format('embedded-opentype'), 
    url('gogoia-deco-webfont.woff') format('woff'), 
    url('gogoia-deco-webfont.ttf') format('truetype'), 
    url('gogoia-deco-webfont.svg#Gogoia') format('svg'); 
    font-weight: normal; 
    font-style: normal; 
} 
@font-face { 
    font-family: 'icomoon'; 
    src:url('icomoon.eot'); 
    src:url('icomoon.eot?#iefix') format('embedded-opentype'), 
    url('icomoon.woff') format('woff'), 
    url('icomoon.ttf') format('truetype'), 
    url('icomoon.svg#icomoon') format('svg'); 
    font-weight: normal; 
    font-style: normal; 
} 
@font-face { 
    font-family: 'gogoiaregular'; 
    src: url('gogoia-regular.eot'); 
    src: url('gogoia-regular.eot?#iefix') format('embedded-opentype'), 
    url('gogoia-regular.woff2') format('woff2'), 
    url('gogoia-regular.woff') format('woff'), 
    url('gogoia-regular.ttf') format('truetype'), 
    url('gogoia-regular.svg#gogoiaregular') format('svg'); 
    font-weight: normal; 
    font-style: normal; 
} 

我是新在GitHub上和我不知道要改变这些字体的工作方式。

回答

2

我也有这个问题。我的字体在本地正常工作,但似乎无法在GitHub上正确使用。

我想出了如何做到这一点:gitHub.io页面的根目录与本地根目录不同,导致字体在错误的文件夹中。

这是我的代码:

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

SubSkipper是我的项目的名称和的.ttf字体是在明显的根目录下我的意思是:“SubSkipper /”。

路径../返回一级,然后打开本地出现的项目的根目录(SubSkipper)。

相关问题