0

@font-face {
    font-family: 'sakal_marathinormal';
    src: url('sakal_marathi_normal-webfont.woff2') format('woff2'),
         url('sakal_marathi_normal-webfont.woff') format('woff'),
         url('Sakal_Marathi_Normal.ttf') format('ttf');
    font-weight: normal;
    font-style: normal;
}

body{
    font-family: sakal marathi;
}

你好我想在我的项目中使用上面的字体样式。我在 style.css 文件中编写了相同的代码。字体位于我的 style.css 文件所在的同一位置。字体的效果显示在我的 PC 上,因为字体安装在我的 PC 上。但是当我运行时我在另一台电脑上的项目没有显示字体效果。

4

3 回答 3

1

实现的字体系列必须与@font-face 中声明的字体系列相同。检查以下示例:

@font-face {
   font-family: myFirstFont;
   src: url(sansation_light.woff);
}

div {
    font-family: myFirstFont;
}
于 2017-04-17T06:00:20.420 回答
0
  1. yes..font effect only in your system.
  2. Because css run from local machine,not from server. better use with some link of the google fonts

@import url('https://fonts.googleapis.com/css?family=Indie+Flower');
body{
font-family: 'Indie Flower', cursive;/* for test*/
}
Hello World..!

于 2017-04-17T05:48:26.550 回答
0

Please try like this

@font-face {
font-family: sakal_marathinormal;
src: url('sakal_marathi_normal-webfont.woff2') format('woff2'),
     url('sakal_marathi_normal-webfont.woff') format('woff'),
     url('Sakal_Marathi_Normal.ttf') format('ttf');
font-weight: normal;
font-style: normal;

}

body{
font-family: sakal_marathinormal;

}

于 2017-04-17T05:49:29.980 回答