简体   繁体   English

如何设置全局字体-CSS

[英]How to set a global font - CSS

I want to set a global font with CSS in one of my projects. 我想在我的一个项目中使用CSS设置全局字体。

What I have tried is the following: 我尝试了以下内容:

@font-face {
    font-family: HoftypeLight;
    src: Valid URL;
}

* {
    font-family: HoftypeLight;
}

but it seems not to work. 但似乎不起作用。

I know that I properly get the font because I have tried to add to one of my texts this class: 我知道我正确地获得了字体,因为我试图将此类添加到我的文本之一:

.test {
   font-family: HoftypeLight;
}

and it works. 而且有效。

Hello I think use like this 你好我认为这样使用

body {
  font-family: Algerian;
}

font same for in all project within the body tag. body标签内所有项目的字体均相同。

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

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