如何应用相同的字体到页面上的一切? [英] How to apply the same font to everything on the page?

查看:95
本文介绍了如何应用相同的字体到页面上的一切?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们说,我想在HTML标题中指定Arial,而且我想将它应用于一切。

Let's say that I want to specify Arial in the HTML header - and I want it to apply to everything.

我必须明确列出每个元素类型吗?或者我可以用单个语句设置它们吗?

Do I have to list each element type explicitly? Or can I set them all with a single statement?

推荐答案

您可以使用适用于一切的 * / p>

You can use the * selector which applies to everything:

<style>
* {
    font-family: Arial;
}
</style>

请注意,这可能是为了您的目的overkill - 由于CSS的性质,样式设置在父元素通常由子元素继承,因此通常足以在 body 元素上设置一个字体样式以应用于整个页面。

Note that this may be overkill for your purposes - due to the nature of CSS, styles set on parent elements are generally inherited by child elements, and thus, it's usually enough to set a font style on the body element to apply to the entire page.

body {
    font-family: Arial;
}

这篇关于如何应用相同的字体到页面上的一切?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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