gpt4 book ai didi

css - 字体不显示?

转载 作者:太空宇宙 更新时间:2023-11-04 12:08:59 25 4
gpt4 key购买 nike

我几乎 100% 确定我所做的是完全正确的这是我目前所拥有的:

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="homepage.css"/>

</head>
<body>
<div id="menu">
<p>THE BIG BLUE SITE OF SAILING KNOWLEDGE</p>
</div>
</body>
</html>

CSS:

@font-face: {font-family: "ostrich-reg"; src: url('Fonts/ostrich-regular-webfont.ttf'); }
@font-face: {font-family: "ostrich-light"; src: url("Fonts/ostrich-light.ttf"); }
@font-face: {font-family: "collab"; src: url("Fonts/ColabThi.otf"); }

#menu {
position: fixed;
top: 0px;
left: 0px;
bottom: 0px;
height: 100vh;
width: 27%;
background: #2d5dac;
text-align: center;
}

#menu p {
color: white;
font-family: ostrich-reg;
font-size: 60px;
}

那里真的没有太多东西,没有太多错误的余地,所以我认为这是我的文件。我从 Font Squirrel 那里得到了这个文件,据我所知,这是一个非常可靠的来源(我之前已经用过几次),但为了好玩,我通过他们的 webfont 生成器运行它,但它仍然没有用.此外,我直接尝试使用另一个文件并得到相同的结果(它也是另一种格式 - .0tf)。所以我不知道。有什么建议吗?

顺便说一下,我知道这在 IE 上不起作用,我今天才开始制作网站,我还不太关心这个。

以下是我尝试过滤字体时发生的情况: Filtering for Fonts...

所以,只要我做对了,我就很确定这意味着字体没有加载。这很奇怪,因为我很确定路径确实是正确的... Fonts 文件夹与 .html 文件位于同一文件夹中,字体直接位于 Fonts 文件夹中。

最佳答案

我在我的一个元素中使用了这种字体。我在我的 CSS 文件中使用了类似的东西(我仍然只以这种方式使用我的所有字体)

CSS

@font-face {
font-family: 'OstrichSansCondensedLight';
src: url('ostrich-light-webfont.eot');
src: url('ostrich-light-webfont.eot?#iefix') format('embedded-opentype'),
url('ostrich-light-webfont.woff') format('woff'),
url('ostrich-light-webfont.ttf') format('truetype'),
url('ostrich-light-webfont.svg#OstrichSansCondensedLight') format('svg');
font-weight: normal;
font-style: normal;

}

但我使用了 .eot、.woff、.ttf、.svg 文件。是的,它在 IE8+ 上工作,因为我使用了 src: url('ostrich-light-webfont.eot?#iefix') format('embedded-opentype'),

如果您遇到任何问题或缺少任何字体文件,请告诉我,我可以尝试为您找到。

关于css - 字体不显示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29172560/

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