如何使用twitter-bootstrap在我的应用程序中添加"Font Awesome"? [英] How can I add 'Font Awesome' to my app with twitter-bootstrap?

查看:69
本文介绍了如何使用twitter-bootstrap在我的应用程序中添加"Font Awesome"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
路轨:使用Awesome字体

Possible Duplicate:
Rails: Using Font Awesome

我有一个Rails应用程序,其中使用了许多twitter-bootstrap的图标.

I have Rails app in which I'm using many twitter-bootstrap's icon.

为此,我确实将"boostrap.css.erb"直接放在/assets/stylesheets/文件夹中
还是直接在/assets/images/文件夹中的"glyphicons-halflings-white.png"和"glyphicons-halflings.png".

For that I did put "boostrap.css.erb" in /assets/stylesheets/ folder directly
also "glyphicons-halflings-white.png" and "glyphicons-halflings.png" in /assets/images/ folder directly.

现在我刚刚下载了真棒字体并提取了.
我猜我必须对这些文件做些什么.谁能告诉我如何设置?

Now I just downloaded Font awesome and extracted.
I'm guessing I have to do something with these files. Can anyone tell me how to set up?

/css/文件夹

  • font-awesome-ie7.min.css
  • font-awesome.css
  • font-awesome.min.css

/font/文件夹

  • fontawesome-webfont.eot
  • fontawesome-webfont.svg
  • fontawesome-webfont.ttf
  • fontawesome-webfont.woff
  • FontAwesome.otf

推荐答案

简单,只需将样式表添加到html的头部

Easy, just add your stylesheets to the head section of your html

    <link href="css/font-awesome.css" rel="stylesheet">
    <!--[if IE 7]>
    <link href="css/font-awesome-ie7.css" rel="stylesheet">
    <![endif]-->

并确保将所有字体文件放在同一文件夹中(我以/css为例).然后,要使用页面上的图标,只需

And make sure you put all the font files in the same folder (I used /css as an example). Then to use the icons on a page, just do

<span class='icon-star'></span> 

(在font-awesome.css文件中使用css插入图标.检查所有可能的类.有很多类似icon-gear,icon-star等)

(that inserts the icon using the css in the font-awesome.css file. Check there for all the possible classes. There's a bunch like icon-gear, icon-star, etc)

这篇关于如何使用twitter-bootstrap在我的应用程序中添加"Font Awesome"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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