字体未应用于我的Web应用程序中 [英] Font not applied in my web application

查看:143
本文介绍了字体未应用于我的Web应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理 grails web应用程序,其中我尝试应用名为<$ c $的字体 c>打开sans 但它不适用于我的Web应用程序。我所遵循的过程是:

我把下面的代码放在了我的扩展文件中。

  @ font-face {
src:url('../../ images / font / openSans.woff');
font-family:'open sans';
/*url('openSans.woff')格式('woff'),* /
font-style:normal;
font-weight:normal;
}

body {
font-family:'open sans';
}

我缺少什么?

解决方案

Open Sans 是一个Google字体,您可以在应用程序中使用它,如链接



将以下内容添加到您的视图或布局中

 < link href ='http://fonts.googleapis.com/css?family = Open + Sans'rel ='stylesheet'type ='text / css'> 

Google Fonts API将生成必要的浏览器特定CSS以使用字体。你所需要做的就是将字体名称添加到你的CSS样式中。例如:

  font-family:'Open Sans',sans-serif; 

请参阅示例 here


I am working on grails web application in which I am trying to apply a font named open sans but it is not applied in my web application. The procedure which I have followed is:

I have put the code below in me extended.css file

@font-face {
    src: url('../../images/font/openSans.woff');
    font-family: 'open sans';
    /*url('openSans.woff') format('woff'),*/
    font-style: normal;
    font-weight: normal;
}

body{
    font-family: 'open sans';
}

What am I missing?

解决方案

Open Sans is a Google font, you can use it in you application as described in the link.

Add following to your view or layout

<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>

The Google Fonts API will generate the necessary browser-specific CSS to use the fonts. All you need to do is add the font name to your CSS styles. For example:

font-family: 'Open Sans', sans-serif;

See example here.

这篇关于字体未应用于我的Web应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆