Html @字体不使用';字体不会改变
除了字体不变外,其他一切都正常。 我不知道问题是否与字体的路径有关,或者我的语法或脚本不正确。 我的Html代码:Html @字体不使用';字体不会改变,html,css,fonts,Html,Css,Fonts,除了字体不变外,其他一切都正常。 我不知道问题是否与字体的路径有关,或者我的语法或脚本不正确。 我的Html代码: <head> <link rel="stylesheet" type="text/css" href="styles/mystyle.css"> </head> <body> <div class="text"> <h1&
<head>
<link rel="stylesheet" type="text/css" href="styles/mystyle.css">
</head>
<body>
<div class="text">
<h1>lorem ipsum.</h1>
<p>Consectetur adipiscing elit.
Nulla condimentum tortor sem,
in semper nisl bibendum eu.</p>
</div>
</body>
/* My css code: */
@font-face
{
font-family: "myFirstFont";
src: url(test-site\fonts\Gotham-Book.otf) format('opentype');
}
.text p
{
font-size:1vw;
font-family:myFirstFont;
color:#f2f2f2;
}
乱数假文。
献祭精英。
Nulla调味品玉米饼,
在semper nisl bibendum欧盟
/*我的css代码:*/
@字体
{
字体系列:“myFirstFont”;
src:url(testsite\font\Gotham Book.otf)格式('opentype');
}
.文本p
{
字体大小:1vw;
字体系列:myFirstFont;
颜色:#F2F2;
}
将字体url中的反斜杠(\
)替换为两个反斜杠(\\
)或一个正斜杠(//code>)
如果使用一个反斜杠,它将被识别为转义字符,即对字符序列中的后续字符调用替代解释的字符
因此,您的代码应该如下所示:
@font-face
{
font-family: "myFirstFont";
src: url(./fonts/Gotham-Book.otf) format('opentype');
}
也许可以试着说:src:url('font\Gotham Book.otf')
?你的css代码在哪里?在“mystyle.css”中?,没问题。我想请您标记正确的anwser,以便人们可以看到它。:)