使用CSS将单一字体应用于整个网站 [英] Applying a single font to an entire website with CSS

查看:128
本文介绍了使用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 {
  font-family: Algerian;
}

页面上的所有元素都将继承此font-family,当然你以后覆盖它)。

All the elements on your page will inherit this font-family then (unless, of course you override it later).

这篇关于使用CSS将单一字体应用于整个网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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