http://www.thinkcmf.com/font/icons/
第一次使用 Font Awesome 发现相当的爽呀!它的图标很全,能够帮你节约时间去找图片。下面就来一起学习吧:
1: 去官方网站下载解压 http://fontawesome.io/
2: 解压后拷贝到你的项目中再引入到你的文件里面 如下:
1
|
< link rel = "stylesheet" type = "text/css" href = "font-awesome-4.0.3/css/font-awesome.css" /> |
3: 开始使用:
1
|
< a href = "#" class = "fa fa-trash-o fa-1g" ></ a > |
注意: fa 是全局必须加入。
fa-trash-0 是你需要的图标类(相当于名字)参考地址: http://fontawesome.io/icons/。
fa-1g 控制大小用的 还有(fa-2x ,fa-3x,fa-4x,fa-5x)。
效果:
代码:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<! DOCTYPE html> < html > < head > < title >font icons test</ title > < meta charset = "ut-8" /> < link rel = "stylesheet" type = "text/css" href = "font-awesome-4.0.3/css/font-awesome.css" /> < style type = "text/css" > .danger{ display: inline-block; 80px; height: 30px; text-align: center; background: brown; border-radius: 5px; font-size: 14px; line-height: 30px; text-decoration: none; color: white; } </ style > </ head > < body > <!--用法一--> < a class = "danger" href = "#" >< i class = "fa fa-trash-o fa-lg" ></ i >Delete</ a > <!--用法二--> < i class = "fa fa-trash-o fa-2x" ></ i > Delete < i class = "fa fa-trash-o fa-3x" ></ i > Delete < i class = "fa fa-trash-o fa-4x" ></ i > Delete <!--用法三--> < a href = "#" class = "fa fa-trash-o fa-5x" ></ a > </ body > </ html > |