Set the font in html5 and html5
@ Font-face commands are introduced in CSS2, but implemented in html5.
Web open font (WOFF) is also supported by all browsers
Most fonts are TrueType (TTF) and OpenType (PTF), while IE implements Embedded OpenType (EOT). There is also a Scalable Vector Graphics (SVG) that is only supported by IOS systems.
Change font
The FontSquirrel website provides various font formats that can meet our needs.
1. Define the font
@ Font-face {/* define the font family you want to use */font-family: 'garogierregular '; /* download the fonts in various formats and place them in the stylesheets/fonts folder *//*. eof file? # The iefix prefix is used to fix a serious Syntax Parsing Bug in IE8. Ignoring this prefix will cause IE8 to produce a 404 error when parsing the remaining rules, the question mark is used to make IE8 take the content after eot as the link position of the query parameter * // * font relative to the style sheet rather than the HTMLd page */src: url ('fonts/garogier_unhinted-wetbot.eot? # Iefix ') format ('embedded-opentype'), url ('fonts/garogier_unhinted-wetfont.woff ') format ('woff '),
url('fonts/garogier_unhinted-wetfont.ttf') format('ttf'), url('fonts/garogier_unhinted-webfont.svg#garogierregular') format('svb');font-weight:normal;font-style:normal;}
2. Apply Fonts
body{font-family:"GarogierRegular";}
/* The browser may not support our fonts. Therefore, you need to prepare multiple alternative fonts. The code above can be changed */
/*
CSS has two types of fonts: General font family and special font family.
CSS provides 5 generic Fonts
Serif font Sans-serif font Monospace font Cursive font Fantasy font so we generally add a general font at the end of the special font Series
*/
Body {font-family: "GarogierRegular", Georgia, "Palatino", "Palatino Linotype", "Times", "Times New Roman", serif ;} we can see that some of the above fonts are enclosed by quotation marks. When there are multiple or special characters such as $ # in the font name, it must be enclosed by quotation marks.