css3--fonts

Source: Internet
Author: User

In previous versions of CSS, web designers had to use fonts already installed on the user's computer.

Using CSS3, a web designer can use any font he or she likes.

When you find the font file you want to use, simply include the font file in the site and it will be automatically downloaded to the user you want.

In the new @font-face rule, you must first define the name of the font (such as Myfirstfont), and then point to the font file.

<!DOCTYPE HTML><HTMLLang= "en"><Head>    <MetaCharSet= "UTF-8">    <title>CSS Fonts</title>    <styletype= "Text/css">     * {margin:0;padding:0;     }@font-face{font-family:Myfirstfont;/* Define name * /src:url (' Sansation_light.ttf ');/* point to Text file * /     }Div{font-family:Myfirstfont;     }         </style></Head><Body>   <Div>Using CSS3, the website can finally use a pre-selected "legit" font other than the font</Div></Body></HTML>

I downloaded this font file on my computer.

So I quoted the font file that I downloaded in advance on my computer.

(Use a lowercase font when referring to the path URL, and uppercase letters in IE will produce unexpected results)

@font-face {       font-family:myfirstfont;       Src:url (' Sansation_light.ttf '); /* Reference the lowercase font file */}

The effect is as follows:

Let's compare this to the time when the font file was not referenced before:

css3--fonts

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.