57

いくつかのフォントを使用したいのですが、クライアント コンピューターにこのフォントがなくても動作するようにしたいと考えています。私はこれをしましたが、うまくいきません:

@font-face {
    font-family: EntezareZohoor2;
    src: url(Entezar2.ttf) format("truetype");
}

.EntezarFont {
    font-family: EntezareZohoor2, B Nazanin, Tahoma !important;
}
4

6 に答える 6

77

次の行は、cssでフォントを定義するために使用されます

@font-face {
    font-family: 'EntezareZohoor2';
    src: url('fonts/EntezareZohoor2.eot'), url('fonts/EntezareZohoor2.ttf') format('truetype'), url('fonts/EntezareZohoor2.svg') format('svg');
    font-weight: normal;
    font-style: normal;
}

cssでフォントを定義/使用するための次の行

#newfont{
    font-family:'EntezareZohoor2';
}
于 2012-07-31T09:44:18.107 に答える
28

このトピックに関する最良の情報源の 1 つは、Paul Irish のBulletproof @font-face syntax article です。

それを読むと、次のようなもので終わります:

/* definition */
@font-face {
  font-family: EntezareZohoor2;
  src: url('fonts/EntezareZohoor2.eot');
  src: url('fonts/EntezareZohoor2.eot?') format('☺'),
       url('fonts/EntezareZohoor2.woff') format('woff'),
       url('fonts/EntezareZohoor2.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

/* use */
body {
    font-family: EntezareZohoor2, Tahoma, serif;
}
于 2012-07-31T09:40:18.897 に答える
5

http://www.w3.org/TR/css3-fonts/ にアクセスしてください。これを

試してください。

  @font-face {
        font-family: 'EntezareZohoor2';
        src: url('EntezareZohoor2.eot');
        src: local('EntezareZohoor2'), local('EntezareZohoor2'), url('EntezareZohoor2.ttf') format('svg');
       font-weight: normal;
       font-style: normal;
    }
于 2012-07-31T09:41:39.950 に答える
2

このlink1link2をお試しください

@font-face {
        font-family: 'RieslingRegular';
        src: url('fonts/riesling.eot');
        src: local('Riesling Regular'), local('Riesling'), url('fonts/riesling.ttf')                       format('truetype');
    }
于 2012-07-31T09:59:36.173 に答える
1

アタテュルクのフォントはこんな風に使いました。「TTF」バージョンは使用しませんでした。元のフォント版(「otf」版)を「eot」「woof」版に翻訳しました。次に、ローカルで動作しますが、ファイルをサーバーにアップロードすると動作しません。ということで、こんな風に「TTF」バージョンも追加。現在、Chrome と Firefox で動作していますが、Internet Explorer はまだ防御しています。コンピュータに「Ataturk」フォントをインストールすると、IEも動作します。しかし、インストールせずにこのフォントを使いたかったのです。

@font-face {
    font-family: 'Ataturk';
    font-style: normal;
    font-weight: normal;
    src: url('font/ataturk.eot');
    src: local('Ataturk Regular'), url('font/ataturk.ttf') format('truetype'), 
    url('font/ataturk.woff') format('woff');
}

私のウェブサイトで見ることができます: http://www.canotur.com

于 2015-07-19T19:33:27.673 に答える