2

fontello からカスタム アイコン フォントをダウンロードし、Meteor アプリで使用する予定です。ダウンロードしたパッケージに付属のデモを試してみたところ、フォントは正常に表示されました。これが私のcssです:

@font-face {
 font-family: 'fontello';
 src: url('fonts/fontello.eot?98991264');
 src: url('fonts/fontello.eot?98991264#iefix') format('embedded-opentype'),
   url('fonts/fontello.woff?98991264') format('woff'),
   url('fonts/fontello.ttf?98991264') format('truetype'),
   url('fonts/fontello.svg?98991264#fontello') format('svg');
font-weight: normal;
font-style: normal;
}

[class^="icon-"]:before, [class*=" icon-"]:before {
 font-family: "fontello";
 font-style: normal;
 font-weight: normal;
 speak: none;
 display: inline-block;
 text-decoration: inherit;
 width: 1em;
 margin-right: .2em;
 text-align: center;

 /* For safety - reset parent styles, that can break glyph codes*/
 font-variant: normal;
 text-transform: none;

 /* fix buttons height, for twitter bootstrap */
 line-height: 1em;

}

.icon-twitter:before { content: '\e805'; } /* '' */
.icon-github-circled:before { content: '\e804'; } /* '' */
.icon-pencil:before { content: '\e801'; } /* '' */
.icon-cancel:before { content: '\e802'; } /* '' */
.icon-chat:before { content: '\e800'; } /* '' */

私のフォルダ構造はそう/client/css/styles.cssで、フォント用です/client/css/fonts/

私のhtmlにこのマークアップを追加しましたが<i class="icon-twitter"></i>、残念ながら、ページを表示したときに表示されるのはこれだけですここに画像の説明を入力 。ありがとう

4

3 に答える 3

0

絶対パスを使用してみてください:

@font-face {
 font-family: 'fontello';
 src: url('/client/css/fonts/fontello.eot?98991264');
 src: url('/client/css/fonts/fonts/fontello.eot?98991264#iefix') format('embedded-opentype'),
   url('/client/css/fonts/fontello.woff?98991264') format('woff'),
   url('/client/css/fonts/fontello.ttf?98991264') format('truetype'),
   url('/client/css/fonts/fontello.svg?98991264#fontello') format('svg');
font-weight: normal;
font-style: normal;
}

/publicまた、プロダクションモードではフォントを保存する方が良いかもしれません/client./fonts//public/fonts

于 2013-06-05T11:27:10.760 に答える
0

私は同じ問題を抱えていましたが、私が解決した方法は、これらの絶対パスを使用することでした:

@font-face {
    font-family: 'icomoon';
    src:url('/fonts/icomoon.eot');
    src:url('/fonts/icomoon.eot?#iefix') format('embedded-opentype'),
      url('/fonts/icomoon.woff') format('woff'),
      url('/fonts/icomoon.ttf') format('truetype'),
      url('/fonts/icomoon.svg#icomoon') format('svg');
    font-weight: normal;
    font-style: normal;
 }

public/fonts/ ディレクトリに直接。MeteorJS はパスを推測するのに十分賢いと思います。

于 2014-01-23T20:05:22.960 に答える