Home  >  Article  >  Web Front-end  >  How to change font in css3

How to change font in css3

WBOY
WBOYOriginal
2021-11-26 14:54:481915browse

In CSS, you can use the "font-family" attribute to change the font. The function of this attribute is to specify the font of the element. You only need to add the "font-family:"font name";" style to the element. .

How to change font in css3

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

How to change the font in css3

You can use the font-family property to change the font in css.

font-family Specifies the font family of the element.

font-family can save multiple font names as a "fallback" system. If the browser doesn't support the first font, it will try the next one. That is, the value of the font-family attribute is a precedence list of font family names or/and class family names to use for an element. The browser will use the first value it recognizes.

There are two types of font family names:

Specified series name: the name of a specific font, such as: "times", "courier", "arial". Common font family names: for example: "serif", "sans-serif", "cursive", "fantasy", "monospace".

Let’s take a look at the specific operation of this attribute through an example. The example is as follows:




  
  
  
  Document
  

怎么样改字体样式

Output result:

How to change font in css3

Add the "font-family:"宋体";" style to the element and output the result:

How to change font in css3

Add the "font-family:"黑体";" style to the element and output the result :

How to change font in css3

(Learning video sharing: css video tutorial)

The above is the detailed content of How to change font in css3. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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