gpt4 book ai didi

css - @font-face 字体不工作

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

我正在尝试从本地存储中获取字体。

@font-face {
font-family: const;
src: url(const.ttf);
}

.fp_title1 {
font-family: 'const', trebuchet ms;
font-size: 350%;
font-weight: 100;
-webkit-text-stroke: 1px;
}

这行不通。我试过重命名文件,使用带引号和不带引号的“字体系列”...

我也试过将字体与 HTML 链接起来

<link href='CSS/const.ttf' rel='stylesheet' type='text/css'>

在同一个文件夹里,名字没错。我不明白。

编辑: 我的 CSS 文件已经链接,字体是 .ttf

最佳答案

您可能在代码中有 2 个错误:路径和扩展。并使用以下格式以及 ttf:

@font-face {
font-family: 'const';
src: url('const.eot'); /* IE9 Compat Modes */
src: url('const.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('const.woff') format('woff'), /* Modern Browsers */
url('const.ttf') format('truetype'), /* Safari, Android, iOS */
url('const.svg#svgFontName') format('svg'); /* Legacy iOS */
}

有助于创建网络字体的网址:

http://www.fontsquirrel.com/tools/webfont-generator

http://www.font-face-generator.com/

关于css - @font-face 字体不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23515616/

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