@font-size a custom Web page font

Source: Internet
Author: User

Usually, in the actual web page development we can only use the computer already installed fonts such as bold, Arial, JAS and so on, if you encounter a special font what should be done? Some people say that using images instead, this can only be used for the local use of special scenes, is the next strategy.


For example: A registration page "registered members" a few words

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/87/55/wKiom1fdSTvyDqWdAAAyA0T-ru0890.png "title=" 01.png "alt=" Wkiom1fdstvydqwdaaaya0t-ru0890.png "/>

CSS3 introduced by the @font-face This property can be a good solution to this problem, can help us very flexible use of some special fonts, even if the user's computer does not have this font installed, the page can be displayed. Of course, as with other properties, IE8 and the following browsers do not support @font-face


Basic syntax:


Font-family: <family-name>; < Customize the name of a font >
Src:url (Sansation_light.woff); < download good fonts, save paths on your PC >
[Font-variant: <font-variant>;]


[Font-style: <style>;]
}

Like what:

@font-face{

Font-family:fangzheng;

Src:url ('.. /font/fangzheng.ttf ');

}

. modal-content h3{

Text-align:center;

Font-family:fangzheng;

font-size:30px;

Color: #EB980E;

}


Compatibility issues:

Webkit/safari (3.2+): Truetype/opentype TT (. ttf), OpenType PS (. OTf);
Opera (+): Truetype/opentype TT (. ttf), OpenType PS (. OTf), SVG (. svg);
Internet Explorer: Supports font files in EOT format since IE4, IE9 supports woff;
Firefox (3.5+): Truetype/opentype TT (. ttf), OpenType PS (. OTf), WOFF (since Firefox 3.6)
Google chrome:truetype/opentype TT (. ttf), OpenType PS (. OTf), WOFF since version 6
It can be concluded from the above:. EoT +. TTF/.OTF + svg + Woff = Perfect support for all browsers.


Here is a font website dedicated to @font-size http://www.fontsquirrel.com/fontface/generator

The Fontsquirrel Web site offers a free @font-face kit generator tool that can generate different font formats and direct demo with CSS and HTML. So that you can refer directly to your website. You can directly use some of the fonts provided by the Fontsquirrel website, or you can upload your own fonts or use them.

@font-face Kit Generator Demo
http://www.xunzou.com/demo/font-face/Chopin-Script-fontfacekit/demo.html
@font-face Kit Generator Demo
http://www.font2web.com/

@font-face Demo
http://www.xunzou.com/demo/font-face/font-face.html

For more information: refer to Http://www.runoob.com/css3/css3-fonts.html

https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face

This article is from the "Dapengtalk" blog, make sure to keep this source http://dapengtalk.blog.51cto.com/11549574/1853453

@font-size a custom Web page font

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.