使用 CSS 将单个字体应用于整个网站 [英] Applying a single font to an entire website with CSS
本文介绍了使用 CSS 将单个字体应用于整个网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在我的整个网站上使用一种名为Algerian"的字体.因此,我需要更改所有 HTML 标签,而且我不想为不同的标签编写不同的代码,例如:
I want to use a single font named "Algerian" across my whole website. So, I need to change all HTML tags and I don't want to write different code for different tags like:
button{font-family:Algerian;}
div{font-family:Algerian;}
下面写的方法也非常不鼓励:
The method written below is also highly discouraged:
div,button,span,strong{font-family:Algerian;}
推荐答案
将 font-family
声明放入 body
选择器:
Put the font-family
declaration into a body
selector:
body {
font-family: Algerian;
}
你页面上的所有元素都将继承这个字体系列(除非你稍后覆盖它).
All the elements on your page will inherit this font-family then (unless, of course you override it later).
这篇关于使用 CSS 将单个字体应用于整个网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文