"; 2. Use the font-family attribute to set, the syntax format is "tag {font -family:"font style"}""/> "; 2. Use the font-family attribute to set, the syntax format is "tag {font -family:"font style"}"">

Home  >  Article  >  Web Front-end  >  How to set font in css

How to set font in css

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-06-01 15:58:4615384browse

How to set fonts in css: 1. Use the font tag to set, the syntax format is ""; 2. Use the font-family attribute to set Settings, the syntax format is "tag {font-family: "font style"}"

How to set font in css

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

1. Font tag configuration font

<font face="字体样式"></font>

Example:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div>未设置字体的“你若盛开,蝴蝶自来”</div>
  <font face="华文中宋">设置字体的“你若盛开,蝴蝶自来”</font>
</body>
</html>

The font tag sets the face font attribute and its value can set different fonts

2. css setting font

css font setting word is font-family

Example:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    p{
      font-family: &#39;Courier New&#39;, Courier, monospace;
    }
  </style>
</head>
<body>
  <p>设置字体的“你若盛开,蝴蝶自来”</p>
  <div>未设置字体的“百无禁忌”</div>
</body>
</html>

Effect :

How to set font in css

Recommended learning: css video tutorial

The above is the detailed content of How to set font in css. 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