-2

css2を使用してサーバーからフォントをロードしたい。サーバーにフォントを保持したい。すべてのブラウザがCSS3をサポートしているわけではないので、CSS3を使用したくないので、css2を使用してそれを行うにはどうすればよいですか。

@font-face
4

2 に答える 2

6
<style type="text/css">
@font-face {
    font-family: 'lucida_sans_unicoderegular';
    src: url('font/lsansuni-webfont.eot');
    src: url('font/lsansuni-webfont.eot?#iefix') format('embedded-opentype'),
         url('font/lsansuni-webfont.woff') format('woff'),
         url('font/lsansuni-webfont.ttf') format('truetype'),
         url('font/lsansuni-webfont.svg#lucida_sans_unicoderegular') format('svg');
    font-weight: normal;
    font-style: normal;

}
#menu {
    font-family: 'lucida_sans_unicoderegular',Times New Roman, Times, serif;
}
</style>

lsansuni-webfont.eot、lsansuni-webfont.wof、..このファイルをフォントフォルダに配置します

このジェネレータを使用して@fontfaceを作成します

http://www.fontsquirrel.com/fontface/generator

于 2012-11-28T05:44:47.937 に答える
1

それは何ですか?

@font-faceはcssルールであり、ユーザーがそのフォントをインストールしていない場合に、サーバーから特定のフォントをダウンロードしてWebページをレンダリングできるようにします。これは、Webデザイナーが、ユーザーがコンピューターにプリインストールした特定の「Webセーフ」フォントのセットに準拠する必要がなくなることを意味します。

使い方:

構文

@font-face {
  font-family: <a-remote-font-name>;
  src: <source> [,<source>]*;
  [font-weight: <weight>];
  [font-style: <style>];
}

@font-face {
  font-family: MyHelvetica;
  src: local("Helvetica Neue Bold"),
  local("HelveticaNeue-Bold"),
  url(MgOpenModernaBold.ttf);
  font-weight: bold;
}

互換性:

IE 6、7、8、9、10、Firefox、Chromeでサポートされています。

于 2012-11-28T05:32:09.887 に答える