简体   繁体   English

@ font-face问题

[英]Problems with @font-face

So my problem is that the fonts used in my nav bar simply won't change and I cannot see the problem with my CSS, please help! 所以我的问题是,导航栏中使用的字体根本不会改变,我的CSS也看不到问题,请帮忙!

CSS 的CSS

//Fonts
@font-face {
    font-family: navfont;
    src: url(fonts/Franchise-Free-Bold.otf);
}

HTML 的HTML

<!DOCTYPE html>
<html>
    <head>
        <style> 
        </style>
        <title>Frost</title>
        <meta content="text/html; charset=utf-8" http-equiv="content-type">
        <link type="text/css" rel="stylesheet" href="stylesheet.css"/>
        <script type="text/javascript" src="script.js"></script>
    </head>
    <body>
        <!--navigation panel-->
        <nav id="nav"> 
        <br>
        <p class="navfield">&nbsp;Home Frost Systems&nbsp;</p>
        <br>
        <a name="systems"></a></nav>
    </body>
</html>

The problem with your CSS code is that "navfont" was not in apostrophes or quotation marks so therefore, it was being treated as a value rather than a string. CSS代码的问题是“ navfont”不在撇号或引号中,因此,它被视为值而不是字符串。 Furthermore, the URL you provided isn't surrounded with the apostrophes/quotations and was also not counted as a string. 此外,您提供的URL不会被撇号/引号引起来,也不会被视为字符串。 As well, you need to declare the font being used for "nav" to correctly display the font. 同样,您需要声明用于“ nav”的字体以正确显示该字体。

CSS 的CSS

@font-face {
    font-family: 'navfont';
    src: url('fonts/Franchise-Free-Bold.otf');
}
nav{
    font-family: 'navfont';
}

An example is located at JSFiddle . 一个示例位于JSFiddle

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM