English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS reference manual

CSS @rules

CSS properties大全

CSS Web Safe Fonts

Web safe fonts are extremely common fonts that are most likely to appear on various operating systems such as Windows, Mac, and Linux.

Why choose Web safe fonts

When the font you try to use on the web page does not appear as it should, it may be because not all computer systems provide all fonts.

To ensure accurate text rendering on most browsers or operating systems, you must define the font very carefully. Thefont-font-familyThe CSS 'font-family' property can accommodate several font names as fallback systems. It starts with the desired preferred font, and if the preferred font is not available, it uses the fallback font.

You should always use the generic font family as the 'font' attribute.-The value of the 'family' attribute, which includes five options: serif, sans-serif, monospace, cursive, and fantasy.-serif, monospace, cursive, and fantasy. If the font you defined is not available, the generic font family allows the browser to select a similar font.

The following table lists the font combinations that are safest to use.

Font familyNormalBold
Arial, Helvetica, sans-serif

This is regular text.

This is bold text.

"Times New Roman", Times, serif

This is regular text.

This is bold text.

"Courier New", Courier, monospace

This is regular text.

This is bold text.

The following example shows how to use font-set the attribute correctly in the family.

.sans-serif-font {
   font-family: Arial, Helvetica, sans-serif;
}
.serif-font {
   font-family: "Times New Roman", Times, serif;
}
.monospace-font {
   font-family: "Courier New", Courier, monospace;
}
Test to see‹/›

Common font combinations

The following table lists some commonly used font combinations organized by general series.

Serif font

Font familyNormalBold
Georgia, serif

This is regular text.

This is bold text.

"Times New Roman", Times, serif

This is regular text.

This is bold text.

"Palatino Linotype", Palatino, "Book Antiqua", serif

This is regular text.

This is bold text.

Sans-Serif font

Font familyNormalBold
Arial, Helvetica, sans-serif

This is regular text.

This is bold text.

"Arial Black", Gadget, sans-serif

This is regular text.

This is bold text.

Impact, Charcoal, sans-serif

This is regular text.

This is bold text.

Tahoma, Geneva, sans-serif

This is regular text.

This is bold text.

"Trebuchet MS", Helvetica, sans-serif

This is regular text.

This is bold text.

Verdana, Geneva, sans-serif

This is regular text.

This is bold text.

Monospace fixed-width font

Font familyNormalBold
Courier, monospace

This is regular text.

This is bold text.

"Courier New", Courier, monospace

This is regular text.

This is bold text.

"Lucida Console", Monaco, monospace

This is regular text.

This is bold text.

Cursive script font

Font familyNormalBold
"Comic Sans MS", cursive

This is regular text.

This is bold text.

"Courier New", Courier, monospace

This is regular text.

This is bold text.

"Lucida Console", Monaco, monospace

This is regular text.

This is bold text.

Fantasy font

There is no fantasy font that has good cross-browser and operating system availability.

 

Warning:Font (Verdana, Georgia, "Comic Sans MS", "Trebuchet MS", "Arial Black", Impact) is valid on Windows and MacOS, but not on Unix + X is invalid.