@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.eot '); /*ie9+*/

Src:url ('.. /FONT/FANGZHENG.WOFF2 ') format (' Woff2 '),

URL ('.. /font/fangzheng.ttf ') format (' TrueType '),

URL ('.. /font/fangzheng.eot #iefix ') format (' Embedded-opentype '); /*ie6-ie8*/

Font-weight:normal;

Font-style:normal;

}


. modal-content h3{

Text-align:center;

Font-family:fangzheng;

font-size:30px;

Color: #333F55;

}


Test effect: CHROME,FIREFOX,IE7-IE11 can be achieved

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/87/B3/wKioL1ffs9bxaTe3AAAJOqPkWy8001.png "title=" 1.png " alt= "Wkiol1ffs9bxate3aaajoqpkwy8001.png"/>


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.


Here is a very detailed blog, for learning, but also thank Bo Http://www.w3cplus.com/content/css3-font-face


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

@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.