How to set font in css

醉折花枝作酒筹
Release: 2023-01-06 11:16:00
Original
15397 people have browsed it

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

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

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

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!

Related labels:
css
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!