http://www.bootcss.com/p/font-awesome/
集成
将Font Awesome 集成到 Bootstrap 非常容易,还可以被单独使用。
最简单的 Bootstrap + Font Awesome 集成方式
使用这种方式将 Font Awesome 集成到默认的 Bootstrap CSS中。
- 拷贝 Font Awesome 字体目录到你的项目中。
- font-awesome.min.css 文件到你的项目中。
- 打开你的项目中的 font-awesome.min.css 文件并编辑字体路径指向正确的位置。
字体路径是相对于你的 CSS 目录的。
- 在html文档中的
<head>
部分,引入 font-awesome.min.css 文件。- <link rel="stylesheet" href="../css/bootstrap.min.css">
- <link rel="stylesheet" href="../css/font-awesome.min.css">
- 在浏览器中打开页面,检查是否正确启用了 Font Awesome!
自定义 Bootstrap + Font Awesome LESS文件的方式进行集成
修改Bootstrap的LESS文件以集成 Font Awesome。
- 拷贝 Font Awesome 字体目录到你的项目中。
- 拷贝 font-awesome.less 文件到 bootstrap/less 目录。
- 打开 bootstrap.less 文件,并将
@import "sprites.less";
替换为@import "font-awesome.less";
- 打开你的项目中的 font-awesome.less 文件,并编辑
@FontAwesomePath
变量,将其值替换为指向字体文件的正确路径。- @FontAwesomePath: "../font";
字体路径相对于存放编译之后的CSS文件的目录。
- 重新编译Bootstrap的所有 LESS 文件。如果你使用的是less.js脚本动态编译的话就能直接在浏览器中看到效果了。
- 在浏览器中打开页面,检查是否正确启用了 Font Awesome!
自定义 Bootstrap + Font Awesome 集成,并使用 SASS 或 SCSS
我也从未使用过SASS或SCSS,如果源码包中的SCSS或SASS文件有问题的话请通知我。
不使用 Bootstrap?
Font Awesome works just as well without Twitter Bootstrap.
- Copy the Font Awesome font directory into your project.
- Copy font-awesome.less or font-awesome.min.css into your project.
- Open your project's font-awesome.less or font-awesome.min.css and edit the font location to point it to your font directory (see above examples).
- Check out the examples to start using Font Awesome!
需要支持 IE7 浏览器?
Font Awesome supports IE7. If you need it, you have my condolences.
- Get Font Awesome working properly in a modern browser.
- Copy font-awesome-ie7.min.css into your project.
- In the
<head>
of your html, reference the location to your font-awesome-ie7.min.css.- <link rel="stylesheet" href="../css/bootstrap.min.css">
- <link rel="stylesheet" href="../css/font-awesome.min.css">
- <!--[if IE 7]>
- <link rel="stylesheet" href="assets/css/font-awesome-ie7.min.css">
- <![endif]-->
- Go complain to whoever decided your project needs IE7 support.
案例
下面的案例大部分都是重用 Bootstrap 文档中的案例。
Use Font Awesome icons in:
- Bulleted lists (like this one)
- Buttons
- Button groups
- Navigation
- Prepended form inputs
- And many more with Custom CSS
New Styles in 3.0
HTML实例
Inline Icons
Place Font Awesome icons just about anywhere with the <i>
tag.
- <i class="icon-camera-retro"></i> icon-camera-retro
更大的图标
通过给图标设置 icon-large
、icon-2x
、 icon-3x
或 icon-4x
样式,可以让图标相对于它所在的容器变得更大。
通过应用 icon-large
(增大 33%), icon-2x
, icon-3x
或 icon-4x
样式让图标变得更大。
icon-camera-retro
icon-camera-retro
icon-camera-retro
icon-camera-retro
- <p><i class="icon-camera-retro icon-large"></i> icon-camera-retro</p>
- <p><i class="icon-camera-retro icon-2x"></i> icon-camera-retro</p>
- <p><i class="icon-camera-retro icon-3x"></i> icon-camera-retro</p>
- <p><i class="icon-camera-retro icon-4x"></i> icon-camera-retro</p>
Animated Spinner
Use the icon-spin
class to get any icon to rotate. Works best with icon-spinner
and icon-refresh
.
- <i class="icon-spinner icon-spin"></i> Spinner icon when loading content...
CSS3 animations aren't supported in IE7 - IE9.
Bordered & Pulled Icons
Use icon-border
and pull-right
or pull-left
for easy pull quotes or article graphics.
- <i class="icon-quote-left icon-4x pull-left icon-muted"></i>
- Use a few of the new styles together ... lots of new possibilities.
- <i class="icon-flag icon-4x pull-left icon-border"></i>
- Use a few of the new styles together ... lots of new possibilities.
按钮
Font Awesome 图标能够很好的应用于按钮组件中。将图标设置的再大也可以,Bootstrap中的
pull-right
、 pull-left
和 icon-spin
样式都可以应用到图标上。
- <a class="btn" href="#">
- <i class="icon-repeat"></i> Reload</a>
- <a class="btn btn-success" href="#">
- <i class="icon-shopping-cart icon-large"></i> Checkout</a>
- <a class="btn btn-large btn-primary" href="#">
- <i class="icon-comment"></i> Comment</a>
- <a class="btn btn-small btn-info" href="#">
- <i class="icon-info-sign"></i> Info</a>
- <a class="btn btn-danger" href="#">
- <i class="icon-trash icon-large"></i> Delete</a>
- <a class="btn btn-small" href="#">
- <i class="icon-cog"></i> Settings</a>
- <a class="btn btn-large btn-danger" href="#">
- <i class="icon-flag icon-2x pull-left"></i>Font Awesome<br>Version 3.0</a>
- <a class="btn btn-primary" href="#">
- <i class="icon-refresh icon-spin"></i> Synchronizing Content...</a>
按钮组
- <div class="btn-group">
- <a class="btn" href="#"><i class="icon-align-left"></i></a>
- <a class="btn" href="#"><i class="icon-align-center"></i></a>
- <a class="btn" href="#"><i class="icon-align-right"></i></a>
- <a class="btn" href="#"><i class="icon-align-justify"></i></a>
- </div>
下拉菜单按钮
- <div class="btn-group open">
- <a class="btn btn-primary" href="#"><i class="icon-user"></i> User</a>
- <a class="btn btn-primary dropdown-toggle" data-toggle="dropdown" href="#"><span class="icon-caret-down"></span></a>
- <ul class="dropdown-menu">
- <li><a href="#"><i class="icon-pencil"></i> Edit</a></li>
- <li><a href="#"><i class="icon-trash"></i> Delete</a></li>
- <li><a href="#"><i class="icon-ban-circle"></i> Ban</a></li>
- <li class="divider"></li>
- <li><a href="#"><i class="i"></i> Make admin</a></li>
- </ul>
- </div>
列表
- Lists
- Buttons
- Button groups
- Navigation
- Prepended form inputs
Easily replace individual bullets.
- <ul class="icons">
- <li><i class="icon-ok"></i> Lists</li>
- <li><i class="icon-ok"></i> Buttons</li>
- <li><i class="icon-ok"></i> Button groups</li>
- <li><i class="icon-ok"></i> Navigation</li>
- <li><i class="icon-ok"></i> Prepended form inputs</li>
- </ul>
导航条
Use Font Awesome icons in navigation to provide helpful visual cues.
- <ul class="nav nav-list">
- <li class="active"><a href="#"><i class="icon-home"></i> Home</a></li>
- <li><a href="#"><i class="icon-book"></i> Library</a></li>
- <li><a href="#"><i class="icon-pencil"></i> Applications</a></li>
- <li><a href="#"><i class="icon-cogs"></i> Settings</a></li>
- </ul>
Prepended form inputs
- <form>
- <div class="input-prepend">
- <span class="add-on"><i class="icon-envelope"></i></span>
- <input class="span2" type="text" placeholder="Email address">
- </div>
- <div class="input-prepend">
- <span class="add-on"><i class="icon-key"></i></span>
- <input class="span2" type="password" placeholder="Password">
- </div>
- </form>
向 Font Awesome 贡献你所创造的图标
Want to help make Font Awesome even more awesome? Contribute back to the Font Awesome community by designing new pictograms for the set.
If selected, you'll retain the CC-BY license to your pictogram and get attribution right here on the Font Awesome site.
How to Submit New Icons
- Download the icon-flag.pdf template.
- Open the PDF in Adobe Illustrator. You'll notice the file has dimensions of 60x56. This is exactly 4x the max icon size of 15 wide by 14 tall. The template is an example of the flag icon to use as a guide.
- Design your icon. In order to make it into the set, your icon must look pixel perfect. The easiest way to do this is to make sure your line widths in the template are some multiple of 4px. Diagonals are rough, too. Don't split pixels right down the middle, as they blur more when rendering. Zoom out to 25% to get a good idea of how it will render in the font.
- Submit your icon. Drop me an email at dave@davegandy.com. Make sure to use the subject
[Font Awesome] [Icon Contribution] icon-name
and attach your PDF file. If your icon makes it into Font Awesome (I'm keeping a very tight reign on quality), I'll ask what contact info you'd like to use for attribution.
路线图
下面是将来版本更新的计划。
- Easier sub-setting with icon packs.
- More icons. Have any requests? Open an issue in the Font Awesome GitHub project.
- Tricks and tips for super-awesome creative CSS methods, like the star example above.
版权协议
- The Font Awesome font is licensed under the SIL Open Font License - http://scripts.sil.org/OFL.
- Font Awesome CSS, LESS, and SASS files are licensed under the MIT License - http://opensource.org/licenses/mit-license.html.
- The Font Awesome pictograms are licensed under the CC BY 3.0 License - http://creativecommons.org/licenses/by/3.0/
- Attribution is no longer required in Font Awesome 3.0, but much appreciated:
Font Awesome by Dave Gandy - http://fortawesome.github.com/Font-Awesome
.
Kyruus
I'm the lead product designer at Kyruus. I wake up every single day excited about my job. Why? Kyruus is going to change healthcare. No exaggeration.
Kyruus is a well-funded, big data healthcare startup in Boston. We believe that the right data at the right time can help doctors make better decisions. We believe data can save lives.
What I love about Kyruus:
- Product design. From the top of the organization, Kyruus is committed to product design done right. It's awesome.
- Purpose. Every day, I get to help make the world a better place – a little at a time.
- People. I work with some of the best people I've ever met. More than just smart people. Good people.
Kyruus needs good people. Designers, app developers, big data masters, & interns that get real responsibility. Come work with me.
Interested? Email me.
Say Thanks
Hopefully you think Font Awesome is awesome. I've put hundreds of hours into the project to give back to the
open source community. If you'd like, here are some ways you can tell me thanks for all my hard work.
Contribute Icons
Contribute icons to make Font Awesome even awesome-er.
Help me buy an iMac
Contribute to a shiny
new iMac for me to keep making great icons.
My Amazon Wish List
Or pick something straight
from my wish list. Gift cards are great.
http://www.bootcss.com/p/font-awesome/的更多相关文章
- Font Awesome图标字体库(2015年05月25日)
Font Awesome是一款非常棒的字体图标工具,给个地址,具体的自已慢慢去体会,只能帮你到这儿了...... http://fortawesome.github.io/Font-Awesome/ ...
- 牛逼的bootcss之buttons
css源码 /*! @license * * Buttons * Copyright 2012-2014 Alex Wolfe and Rob Levin * * Licensed under the ...
- 浅谈字体小图标font awesome,iconfont,svg各自优缺点
三种都是矢量图(即放大不失真),但是个自又有个自的优缺点, 1.font awesome: 优点:相对比较简单,查看官网看例子基本上都会用 (http://www.bootcss.com/p/font ...
- 图标网站,IcoMoon,自己动手做一个 font
很有用的IcoMoon,在线制作工工具:https://icomoon.io/app/#/select/font 大神解说:如何灵活利用免费开源图标字体-IcoMoon篇http://www.zhan ...
- Bootstrap & Font Awesome 学习笔记
学习网站:http://bootstrap.ninghao.net/index.html https://www.freecodecamp.cn http://www.runoob.com/boots ...
- (22)bootstrap 初识 + Font Awesome(字体图标库)
bootstrap作用就是简化布局 bootstrap是基于JQ的,所以内部代码使用的是jq语法 所以要使用bs,必须先倒入 1.head标签内倒入bs的css文件 <link rel=&qu ...
- Font Awesome(一套很棒的图标库)
Font Awesome 是一个非常方便的图标库.这些图标都是矢量图形,被保存在 .svg 的文件格式中.这些图标就和字体一样,你可以通过像素单位指定它们的大小,它们将会继承其父HTML元素的字体大小 ...
- Font Awesome 完美的图标字体
好久没来,虽说鄙人的人气不咋地,但还是很想念自己这一亩二分田地. 近期用在平台开发中,看着设计师摆开阵势,准备大画图标,想着自己将会很KUBI拼凑css-sprite图片,接着写一大堆 class^= ...
- TP5.1:将外部资源引入到框架中(css/js/font文件)
为了让我们的框架形式变得更加好看,我们需要加入Bootstrap和Jq文件到框架中 1.通过Bootstrap和jq官网进行相关文件的下载 (1)Bootstrap下载地址:https://v3.bo ...
- Font Awesome入门教程
Font Awesome 图标 Font Awesome 是一套绝佳的图标字体库和CSS框架. Font Awesome 字体为您提供可缩放矢量图标,它可以被定制大小.颜色.阴影以及任何可以用CSS的 ...
随机推荐
- 原生DOM操作vs框架虚拟DOM比较
1. 原生 DOM 操作 vs. 通过框架封装操作. 这是一个性能 vs. 可维护性的取舍.框架的意义在于为你掩盖底层的 DOM 操作,让你用更声明式的方式来描述你的目的,从而让你的代码更容易维护.没 ...
- Codeforces Round #394 (Div. 2) B. Dasha and friends(暴力)
http://codeforces.com/contest/761/problem/B 题意: 有一个长度为l的环形跑道,跑道上有n个障碍,现在有2个人,给出他们每过多少米碰到障碍,判断他们跑的是不是 ...
- Solidity 官方文档中文版 2_Ethereum 智能合约介绍
一个简单的智能合约 先从一个非常基础的例子开始,不用担心你现在还一点都不了解,我们将逐步了解到更多的细节. Storage contract SimpleStorage { uint storedDa ...
- 前端工程化 - bower
什么是bower bower是前端的包管理工具,类似于php的composer,python的pip,虽然先如今bower已经停止了更新(主要是因为Browserify和Webpack等包管理工具的兴 ...
- 解决QML Window 增加radius效果
做开发时,突然遇到 一个需要模态展示的对话框,做出来后,发现还要radius属性,增加时发现,Window控件不支持这个属性.如果是以前,原本就打算放弃了,但想一下,这种应该是支持的,既然接口上没有, ...
- python 读空的json文件
读空的json文件,python2和python3 的错误提示是不一样的 python2: ValueError: No JSON object could be decoded python3: j ...
- 树状数组 Binary Indexed Tree/Fenwick Tree
2018-03-25 17:29:29 树状数组是一个比较小众的数据结构,主要应用领域是快速的对mutable array进行区间求和. 对于一般的一维情况下的区间和问题,一般有以下两种解法: 1)D ...
- Model/ModelMap 和 ModelAndView 的区别使用
Model/ModelMap 和 ModelAndView 的区别使用 Model/ModelMap controller: package springmvc.controller; import ...
- Getting 'The AWS Access Key Id you provided does not exist in our records' error with Amazon MWS
I upgraded from one version of Amazon MWS (marketplace web service) version https://mws.amazonservic ...
- bzoj1054: [HAOI2008]移动玩具 状压+爆搜即可
题意:在一个4*4的方框内摆放了若干个相同的玩具,某人想将这些玩具重新摆放成为他心中理想的状态,规定移动时只能将玩具向上下左右四个方向移动,并且移动的位置不能有玩具,请你用最少的移动次数将初的玩具状态 ...