天天学习一点点 编程PDF电子书、视频教程免费下载:
http://www.shitanlife.com/codecss
微信小程序不能识别不少文件, 其中就包括外部的字体文件. 那咱们怎么突破他的防火线呢, 这里主要用得就是在线的字体库. 它的使用不像以前引用阿里巴巴字体库那样简单。html
步骤以下:web
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
@font-face {
font-family
:
"iconfont"
;
src
:
url
(
'iconfont.eot?t=1484311526877'
);
/* IE9*/
src
:
url
(
'iconfont.eot?t=1484311526877#iefix'
)
format
(
'embedded-opentype'
),
/* IE6-IE8 */
url
(
'iconfont.woff?t=1484311526877'
)
format
(
'woff'
),
/* chrome, firefox */
url
(
'iconfont.ttf?t=1484311526877'
)
format
(
'truetype'
),
/* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
url
(
'iconfont.svg?t=1484311526877#iconfont'
)
format
(
'svg'
);
/* iOS 4.1- */
}
.iconfont {
font-family
:
"iconfont"
!important
;
font-size
:
16px
;
font-style
:
normal
;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-sousuo:before {
content
:
"\e604"
; }
.icon-stars:before {
content
:
"\e605"
; }
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
//更改后的代码
@font-face {
font-family
:
'iconfont'
;
/* project id 218229 */
src
:
url
(
'//at.alicdn.com/t/font_1oyoojup1w34bo6r.eot'
);
src
:
url
(
'//at.alicdn.com/t/font_1oyoojup1w34bo6r.eot?#iefix'
)
format
(
'embedded-opentype'
),
url
(
'//at.alicdn.com/t/font_1oyoojup1w34bo6r.woff'
)
format
(
'woff'
),
url
(
'//at.alicdn.com/t/font_1oyoojup1w34bo6r.ttf'
)
format
(
'truetype'
),
url
(
'//at.alicdn.com/t/font_1oyoojup1w34bo6r.svg#iconfont'
)
format
(
'svg'
);
}
.iconfont {
font-family
:
"iconfont"
!important
;
font-size
:
16px
;
font-style
:
normal
;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-sousuo:before {
content
:
"\e604"
; }
.icon-stars:before {
content
:
"\e605"
; }
|
引用以下:chrome
1
2
|
//iconfont 必须添加的,后面的是选中的样式类名(老套路了)
<
text
class="iconfont icon-shouye"></
text
>
|