Home > Article > Web Front-end > How to set the font in css to Microsoft Yahei
How to set the css font to Microsoft YaHei: You can use the font-family attribute to set it, such as [font-family: "Microsoft YaHei"] or [font-family: "Microsoft YaHei";].
Related attributes:
font - The family attribute specifies the font of an element.
(Learning video recommendation: css video tutorial)
Attribute value:
family-name/generic-family Use A priority list of font family names and/or class family names for an element. Default: Depends on browser.
inherit Specifies that the font family should be inherited from the parent element.
family-name - Specified family name: the name of the specific font, such as: "times", "courier", "arial".
generic-family - Common font family names: For example: "serif", "sans-serif", "cursive", "fantasy", "monospace.
Example:
In CSS, you can use the font-family attribute to set the font to Microsoft Yahei. Syntax:
font-family:"微软雅黑";
But you need to pay attention to one thing. Usually when we use Chinese fonts, we will use the English name instead of Use Chinese directly. Therefore, you can also set it like this:
font-family:"Microsoft YaHei";
Related recommendations: CSS tutorial
The above is the detailed content of How to set the font in css to Microsoft Yahei. For more information, please follow other related articles on the PHP Chinese website!