How to set the font in css to Microsoft Yahei

王林
Release: 2020-11-18 10:47:58
Original
8278 people have browsed it

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";].

How to set the font in css to 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:"微软雅黑";
Copy after login

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";
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!