CSS Web pages use custom font methods

Source: Internet
Author: User

@font-face can load the server-side fonts to the browser side, so that designers can not be limited by the client font library.

In general, there are four types of font files that can overwrite all browsers. These four formats are:

. EOT: Applies to Internet Explorer 4.0+.

. TTF or. OTF: For Firefox 3.5, Safari, Opera.

. SVG: For Chrome, IPhone.

. WOFF: The font format standard specified for Web fonts is widely supported by the new version of the browser.

Syntax + Example: write in CSS as follows

{      font-family: ' afish ';      src: url ('.. /fonts/afish-webfont.eot ');      src: url ('.. /fonts/afish-webfont.eot? #iefix ') format (' Embedded-opentype '),     url (' ... /fonts/afish-webfont.woff ') format (' Woff '),     url ('.. /fonts/afish-webfont.ttf ') format (' TrueType '),     url ('.. /fonts/afish-webfont.svg#afish ' Format (' svg ');      font-weight: normal;      font-style: normal;}

Here is the relative path, of course, you can also use the absolute path. Here we need to apply the defined font to the actual page:

With the font definition above, you can use the Afish font. As follows:

Body {    font-family: afish;     width: 100%;     height: 100%;     color: red;}

To get the font format required for @font-face:
The special font is already in your computer, and now we need to find a way to get the @font-face. Eot,.woff,.ttf,.svg font format. To get these font formats, also need third-party tools or software to implement, below I recommend a tool font Squirrel.

CSS Web pages use custom font methods

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.