Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add some non-standard font to a website?

Is there a way to add some custom font on a website without using images, Flash or some other graphics?

For example, I was working on a wedding website, and I found a lot of nice fonts for that subject. But I can't find the right way to add that font on the server. And how do I include that font with CSS into the HTML? Is this possible to do without graphics?

like image 828
vaske Avatar asked Sep 20 '08 11:09

vaske


People also ask

How do you include a non-standard font in a website?

The only way to ensure a non-standard font is displayed correctly is to embed the font into the . css (see Non-Standard Fonts below).

Can you use custom fonts on a website?

Yes, there is a way. Its called custom fonts in CSS. Your CSS needs to be modified, and you need to upload those fonts to your website.

How would you implement a Web design comp that uses non-standard fonts?

How would you implement a web design comp that uses non-standard fonts? ​ Use @font-face and define font-family for different font-weight s.


1 Answers

This could be done via CSS:

<style type="text/css"> @font-face {     font-family: "My Custom Font";     src: url(http://www.example.org/mycustomfont.ttf) format("truetype"); } p.customfont {      font-family: "My Custom Font", Verdana, Tahoma; } </style> <p class="customfont">Hello world!</p> 

It is supported for all of the regular browsers if you use TrueType-Fonts (TTF), the Web Open Font Format (WOFF) or Embedded Opentype (EOT).

like image 57
3 revs, 3 users 80% Avatar answered Oct 14 '22 16:10

3 revs, 3 users 80%