0

嗨,我刚刚开始在 Monaca IDE 中开发,我似乎无法在我的 phonegap 应用程序中实现字体。

@font-face {
    font-family: "customfont";
    src: url("components/monaca-onsenui/css/font_awesome/fonts/Roboto-Light.ttf") format("opentype");   
        /* Make sure you defined the correct path, which is related to
            the location of your file `my_css.css` */ 
    }
    body {
        font-family: "customfont";
        font-size:30px;
    }

这是我要使用的字体的css,它没有实现......

有人可以对此有所了解吗?

4

1 回答 1

2

你确定网址正确吗?字体文件是否正确加载?

以下代码应该可以工作:

@font-face {
  font-family: 'Roboto';
  src: url('https://cdnjs.cloudflare.com/ajax/libs/materialize/0.96.1/font/roboto/Roboto-Regular.ttf');
}

body {
  font-family: 'Roboto';
  font-size: '30px';
}

http://codepen.io/argelius/pen/XbWzMV

于 2015-04-23T02:33:10.493 回答