将字体系列应用于整个页面不起作用 [英] Applying a font family to a whole page doesn't work

查看:75
本文介绍了将字体系列应用于整个页面不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将一种字体应用于整个页面,但有些事情阻止我这样做。



我尝试过的方法:



我在网上查了但没有帮助我,有人说使用这段代码:



* {

font-family:Verdana;

}





我试过把它在体内,头部,什么都没有,有人说用而不是*用身体,试过它,没用。我看到如果我的代码一般都工作了,我试着用选择器改变单个段落的字体并且它有效。



* {

font-family:Verdana;

}







什么

owo



.btn {

font-size:55px;

}

.btn-danger {

background-color:red;

}

.btn-success {

background:rgba(128,0,0,... 25);

font-family:fantasy;

}



blacks111

I want to apply a single font to an entire page, but something is stopping me from doing it.

What I have tried:

I checked online but nothing helped me, some said use this code:

*{
font-family: Verdana;
}


I tried putting it in the body, head, nothing, some said instead of * to use body, tried it, didn't work. I saw if my code even worked in general, I tried to change the font of a single paragraph with a selector and it worked.

*{
font-family: Verdana;
}



what
owo

.btn {
font-size: 55px;
}
.btn-danger {
background-color: red;
}
.btn-success {
background: rgba(128, 0, 0, .25);
font-family: fantasy;
}

blacks111

推荐答案

* {
  font-family: Verdana;
}

.btn-success {
  background: rgba(128, 0, 0, .25);
  font-family: fantasy;
}





你可能不明白CSS是如何工作的......

第一个规则设置所有元素的字体,但第二个覆盖对于那些类 .btn-success

CSS规则顺序很重要......



You probably do not understand how CSS works...
The first rule sets the font for all elements, but the second overrides it for those with class .btn-success
CSS rule order does matter...


这篇关于将字体系列应用于整个页面不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆