我刚刚将新网站托管在GitHub上。我在其中使用了一些自定义字体,这些字体是我在index.html
和style.css
文件旁边上传的:
字体代码:
@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的新手,我不知道要进行哪些更改才能使这些字体正常工作。
我也有这个问题。我的字体在本地可以正常工作,但是在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)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句