开发者

HTML how to use different fonts

if i place my ttf font file in my websites 开发者_JS百科root folder lets say named AMC.tff and in my website use <font face="AMC"> is it going to work... if not than what is the method to use unusual fonts in your website


You can include True Type Fonts with the help of the CSS 3 property @font-face. The following CSS would apply your AMC font to all <h1/> tags:

@font-face {
  font-family: "AMC";
  src: url("./AMC.ttf") format("truetype");
}
h1 {
  font-family: "AMC", sans-serif;
}

For browsers that have no support for webfonts you should specify a similar alternative to your font. In the above example sans-serif would be used if AMC cannot be found because the @font-face tag was not recognized by the browser.


No, the fonts in a browser is based on fonts installed on the visitor's machine.

I don't know much about this area, so I can't tell you which one of these works or is considered best practices, but check out:

  • SiFr
  • typeface.js
  • Cufon


No. Apart from the fact that <font>is deprecated, you have to use the CSS3 @font-face directive, or older more compatible methods such as Cufon and Sifr.


If you need to use Custom Font for your site, you can give a go for Cufon

http://cufon.shoqolate.com/generate/

Detailed Tutorial for using CUfon on your site

http://net.tutsplus.com/articles/news/the-easiest-way-to-use-any-font-you-wish/

Forgot to add, You can also use CSS3 property

@font-face

Supported by FF3.5 and above, Opera 10 and above, IE 7,8(not sure about 6)


Check this link out: How to get non-standard font with effect in use of web site?

I have explained in detail how to embed fonts in a webpage and make it browser compatible. Font embedding is also a risky affair, as the font license sometimes doesn't allow.

PS - And please make sure that you don't repeat questions in stackoverflow as this question has been answered many times.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜