Phonegap:自定义字体不起作用

7 css android font-face cordova phonegap-build

我正在使用自定义字体样式在PhoneGap中执行应用程序.字体样式是在浏览器中,而不是在Android手机中.

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


body{font-family:'CooperStd' , arial ;   }

</style>
Run Code Online (Sandbox Code Playgroud)

我检查了字体路径,它是正确的还在浏览器中检查控制台.我发现没有错误.

提前致谢

Pal*_*der 2

您可以尝试使用根文件夹的相对路径,即代替:

src: url('fonts/cooperblackstd.eot');
Run Code Online (Sandbox Code Playgroud)

尝试

src: url('/fonts/cooperblackstd.eot');
Run Code Online (Sandbox Code Playgroud)

假设 fonts 是与 www 文件夹下的 .html 文件处于同一级别的文件夹。

问候,