The font attribute can be used to stylize the flow content (or text) in an HTML element. There are many font attributes that are very specific; however there are two very important font attributes that are commonly used. The most commonly used font attributes include: “font-size” and “font-family”.
字体属性可用于设置HTML元素中的流数据内容(或文本)的样式。有许多字体属性非常具体;但是,有两个非常重要的字体属性是常用的:“字体大小”和“字体系列”。
Syntax 语法:
The font-family attribute is written as 字体系列属性写为:
style-name{font-family:verdana, arial, sans-serif; }
style-name{font-family:georgia, times, serif; }
Note: A font-family usually has more than one font listed, and the order of the fonts in the list can be modified. The provided example only includes three font types; however a font-family can have as many fonts as the programer wants to include, and fonts should be listed in their preferred order by the programer. If a computer does not have the preferred font installed then the next font in the list will be used instead. If none of the preferred fonts are available then a generic font will be used.
注意:一个字体系列通常列出多个字体,并且可以修改列表中字体的顺序。提供的示例仅包括三种字体类型;但是,字体系列可以包含编程人员希望包含的任意多个字体,并且编程人员应按首选顺序列出字体。如果计算机未安装首选字体,则将使用列表中的下一种字体。如果没有首选字体可用,则将使用通用字体。
The font-size attribute is written using any of the following three methods:
字体大小属性使用以下三种方法之一写入:
style-name{font-size:____%; }
style-name{font-size:____pt; }
style-name{font-size:____px; }