1024programmer CSS How does CSS refer to external ttf fonts?

How does CSS refer to external ttf fonts?

In CSS, you can use the font-face attribute to refer to external fonts. The font-face attribute can realize the call of any external special font, for example: . ttf font.

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.

To use a font for an HTML element, please refer to the name of the font (myFirstFont) through the font-family attribute.

The font-face attribute refers to a ttf font example:

Example 1:


Example 1:

@font-face
 {
 font-family: myFirstFont;
 src: url('aa.ttf'),
      url('aa.eot'); /* IE9+ */
 font-weight: bold;
 }

Browser support for the font-face attribute:

Firefox, Chrome, Safari and Opera support .ttf (True Type Fonts ) and .otf (OpenType Fonts) type fonts.

Internet Explorer 9+ supports the new font-face rules, but only for fonts of type .eot (Embedded OpenType).

The above is how CSS references external ttf fonts? For more details, please pay attention to other related articles on 1024programmer.com!

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/how-does-css-refer-to-external-ttf-fonts/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索