Set the font in html5 and html5

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.