Css 简明教程

CSS - Font

CSS 字体允许使用各种与字体相关的属性来自定义网页的字体样式。在本教程中,我们将了解 CSS 中的字体样式。

CSS Fonts allows to customize font style of webpages using various font related properties. In this tutorial we will understand the font styling in CSS.

What is CSS Font?

在 CSS 中,font 属性用于设置和调整网页中使用的文本类型。

In CSS font property is used to style and adjust type of text used in webpage.

你可以通过设置 * font-family, font-size, font-weight* 和 * font-style.* 属性来定义字体并自定它们的显示样式。你还可以使用 * font* 速记属性来操作所有字体样式。

You can define fonts and customize their appearance by setting properties like font-family, font-size, font-weight and font-style. You can also use shorthand property font to manipulate all the font style.

Table of Contents

Types of Font Families

  1. Monospace Fonts: The font in which every letter have equal width.

  2. Serif Fonts: Have small stroke at the edge of each letter.

  3. San-Serif Fonts: Clean fonts with out any strokes.

  4. Fantasy Fonts: Decorative fancy fonts.

  5. Cursive Fonts: The font that resembles human handwriting.

Generic Font Family

Examples of Font Names

Serif

Times New RomanGeorgiaGaramond

Sans-serif

ArialVerdanaHelvetica

Monospace

Courier NewLucida ConsoleMonaco

Cursive

Brush Script MTLucida Handwriting

Fantasy

CopperplatePapyrus

Property

Description

Example

font-family

Specifies the font for an element.

Try It

font-size

Specifies the size of the font.

Try It

font-weight

Specifies the boldness of the font.

Try It

font-style

Specifies the style of the font (normal, italic, oblique).

Try It

font-variant

Specifies whether or not a text should be displayed in a small-caps font.

Try It

line-height

Specifies the line height.

Try It