【问题标题】:Font not loading in Monaca onsen ui字体未在 Monaca onsen ui 中加载
【发布时间】:2015-04-22 17:02:14
【问题描述】:

您好,我刚开始在 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,它没有实现...

有人能解释一下吗?

【问题讨论】:

    标签: css cordova monaca


    【解决方案1】:

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

    以下代码应该可以工作:

    @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

    【讨论】:

    • 你用的是什么浏览器?如果字体文件正确加载,我不明白为什么它不应该工作。
    • 我正在使用 chrome。当我加载到 monaca 调试器时它无法工作
    • 请说得清楚一点。它是否在 Chrome 中工作,但在 Monaca 调试器中不工作?
    • 你如何检查 chrome?
    猜你喜欢
    • 2017-09-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-23
    相关资源
    最近更新 更多