gpt4 book ai didi

css - @font-face 不工作 css3

转载 作者:行者123 更新时间:2023-11-28 12:36:53 26 4
gpt4 key购买 nike

我试图让@font-face 与 Chrome 和 Firefox 一起工作,但我没有运气。

我正在使用的代码可以在 http://testing.teachyourselfstuff.com 找到在这里

main.css 文件

@font-face {
font-family: FamilyName;
src: url('http://testing.teachyourselfstuff.com/media/3Dumb.ttf');
}

.3DFont {
font-family: FamilyName, serif;
}

index.html 文件

<!doctype html>

<html>

<head>
<meta charset="UTF-8">
<meta name="author" content="Daniel Foreman">
<meta name="description" content="This is my hand coded html5 template.">
<meta name="generator" content="Bluefish 2.2.5" >
<meta name="keywords" content="basic, template, html5, css">

<title>My website</title>

<link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="icon" type="image/x-icon" href="favicon.ico" >
<link rel="author" type="text/plain" href="humans.txt">
</head>

<body>

<p class="3DFont">This is test text.</p>


<script src="js/plugins.js"></script>
<script src="js/main.js"></script>
</body>

</html>

如果有人能指出正确的方向,我将不胜感激。

最佳答案

您的 CSS 标识符 (3DFont) 不能以数字开头。

In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-zA-Z0-9] and ISO 10646 characters U+00A0 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, two hyphens, or a hyphen followed by a digit. Identifiers can also contain escaped characters and any ISO 10646 character as a numeric code (see next item). For instance, the identifier "B&W?" may be written as "B\&W\?" or "B\26 W\3F".

有关更多信息,请查看 CSS 规范:http://www.w3.org/TR/CSS2/syndata.html#value-def-identifier

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

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