gpt4 book ai didi

html - 将自定义字体添加到 GitHub 页面

转载 作者:太空狗 更新时间:2023-10-29 15:59:42 24 4
gpt4 key购买 nike

我刚刚在 GitHub 上托管了我的新网站。我在那里使用了一些自定义字体,我将它们上传到 index.htmlstyle.css 文件旁边:

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 的新手,我不知道要更改什么才能使这些字体正常工作。

最佳答案

我也遇到过这个问题。我的字体在本地可以正常工作,但似乎无法在 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)。

关于html - 将自定义字体添加到 GitHub 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35718750/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com