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

How to change font in css

coldplay.xixi
coldplay.xixiOriginal
2021-04-28 16:02:419808browse

How to change fonts in css: 1. You can use [font-family] to change the font style; 2. Use the [font-weight] attribute to change the font thickness; 3. Use the color attribute to change the font color.

How to change font in css

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

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

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 change 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
Previous article:How to set css image sizeNext article:How to set css image size