Html CSS 无法将“Avenir Next”识别为我的字体系列

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23754655/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 01:50:41  来源:igfitidea点击:

CSS Not Recognizing "Avenir Next" as my font family

htmlcss

提问by Aakash Kumar

I am using CSS for my headers where all menus should be coming as "Avenir Next" font-family. But it is not recognizing it. It is showing as simple Arial.

我正在为我的标题使用 CSS,其中所有菜单都应该作为“Avenir Next”字体系列出现。但它不承认它。它显示为简单的 Arial。

My code is :

我的代码是:

#main .Header .mainnav ul {
  float: left;
  list-style: none;
  margin: -17px 0 0;
  padding: 0;
  font-family: Avenir Next !important;
  font-size: 14px; 
} 

回答by Vedant Terkar

Try:

尝试:

#main .Header .mainnav ul {
    float: left;
    list-style: none;
    margin: -17px 0 0;
    padding: 0;
    font-family: "Avenir Next" !important;
    font-size: 14px; 
}

It is because of " "Space in font name.

这是因为" "字体名称中有空格。

By Looking at your last comment, I'll suggest you to host a font-filein either a .ttf, .oteor .otfformat and link that file in your page.

通过看你最后的评论,我会建议你主持一个font-file在任何一个.ttf.ote.otf格式和链接,在你的页面文件。

and use this code:

并使用此代码:

@font-face {
  font-family: 'Avenir Next';
  src: url("http://www.yoursite.com/fonts/Avenir_Next.otf"); /* File to be stored at your site */
  }

That will help you even if your font is not installed at your clients computer.

即使您的客户端计算机上未安装您的字体,这也会对您有所帮助。

Hope it'll help you. cheers :)!

希望它会帮助你。欢呼:)!