@font-face (CSS3 property) to embed any font in a Web page

Source: Internet
Author: User

@font-face Grammar Rules

@font-face {   font-family: <YourWebFontName>;   SRC: <source> [<format>][,<source> [<format>]]*;   [Font-weight: <weight>];   [Font-style: <style>]; }
Description:

    1. Yourwebfontname: This value refers to the name of your custom font, preferably using the default font you downloaded, which will be referenced to the font-family in your Web element. such as "font-family:" Yourwebfontname ";"

    2. Source: This value refers to the stored path of your custom font, which can be a relative path or an absolute path;

Format: This value refers to the formatting of your custom font, which is mainly used to help the browser identify the following types of values: TRUETYPE,OPENTYPE,TRUETYPE-AAT,EMBEDDED-OPENTYPE,AVG, etc. Weight and style: These two values must be familiar, weight defines whether the font is bold, style primarily defines the font style, such as italic.

instance: (Take singlemaltaregular as an example)

    1. < P style= "margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px "> Download the required fonts.

    2. get @font-face the required. Eot,.woff,.ttf,.svg font format font. Can be done on this website. Click to enter   (fontsquirrel )

    3. font squirrel Download the file to the local computer, unzip it. You can get the font.

    4. Create a new folder in the project fonts, say download fonts put in.

Style writing format:

@font-face {   font-family: ' Singlemaltaregular ';      Src:url ('.. /fonts/singlemalta-webfont.eot ');     Src:url ('.. /fonts/singlemalta-webfont.eot? #iefix ') format (' Embedded-opentype '),         url (' ... /fonts/singlemalta-webfont.woff ') format (' Woff '),      url ('.. /fonts/singlemalta-webfont.ttf ') format (' TrueType '),       url ('.. /fonts/singlemaltawebfont.svg#singlemaltaregular ') format (' SVG ');   Font-weight:normal;   Font-style:normal;}?


The last font you can refer to:

body{  font-family: ' Singlemaltaregular '}

Note: Files downloaded from the website will be automatically generated and copied directly.

@font-face (CSS3 property) to embed any font in a Web page

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.