Using non-standard font in web pages? [closed]
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this questionI have been told to create a website using a non standard font. The client has supplied the font file (in the .otf format). Is there any way I can have the text on the webpage show up in the specified font (non-web standard) ?
Is there any other alternative other than using sIFR ?
EDIT : How do i apply this @font-face only to a particular div ?
You can use the CSS @font-face
declaration for this.
However, beware: not all browsers support the otf
format.
You can use a tool such as FontSquirrel's Font-face Generator to convert the font into all the different formats you'll need. It'll even generate the CSS for you, which you'll then simply copy and paste into your project.
Not 100% supported, but:
@font-face {
font-family: MyFont;
src: url('MyFont.otf');
}
Alternatively, you could use Cufon font replacement:
http://cufon.shoqolate.com/generate/
It does have some drawbacks however: text can't be copied and it uses javascript which may be a problem in some very old browsers of if someone is browsing with js turned off.
CSS 3 has given browsers the ability to download and use TTF file formats. As usual IE gives partial support. As usual, Google to the rescue.
http://code.google.com/apis/webfonts/docs/getting_started.html
精彩评论