Home  >  Article  >  Web Front-end  >  How to modify fonts in css

How to modify fonts in css

coldplay.xixi
coldplay.xixiOriginal
2021-04-16 16:51:433930browse

The way to modify the font in css is to use [font-family] to specify the font family of the element. [font-family] can save multiple font names as a [fallback] system.

How to modify fonts in css

The operating environment of this tutorial: windows7 system, css3 version, DELL G3 computer.

How to modify 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".

Usual font family names: For example: "serif", "sans-serif", "cursive", "fantasy", "monospace"

The font-weight attribute sets the thickness of the text.

Description

This attribute is used to set the bold font used in the text of the display element. The numeric value 400 is equivalent to the keyword normal, and 700 is equivalent to bold. The font bold for each numeric value must be at least as thin as the next smallest number, and at least as thick as the next largest number.

Example of how to change fonts in css:

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>DIV+CSS怎么样改字体样式</title>
<style>
.one{
font-family:"微软雅黑";  //把 font-family: "设置字体名称" 里的字体名称改成你需要
font-size:12px;  //字体大小
color:red;  //字体颜色
font-weight:normal; //加粗 normal默认值 bold粗体 数值100-900
}
</style>
</head>
<body>
<div class="one">DIV+CSS怎么样改字体样式</div>
</body>
</html>

Recommended related tutorials: CSS video tutorial

The above is the detailed content of How to modify fonts 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
Previous article:How to introduce cssNext article:How to introduce css