微信小程序引入Font Awesome-icon

栏目: IOS · Android · 发布时间: 7年前

内容简介:---End---

1下载最新版本Font Awesome

选择最新免费使用版本下载:

https://www.thinkcmf.com/font_awesome.html

2 将字体转换为 BASE64

2.1 进入转换网站transfonter.orghttps://transfonter.org/

2.2 解压下载好的 fontawesome-free-5.0.13.zip

2.3 点击网址上的Add fonts:

微信小程序引入Font Awesome-icon

点击Add fonts

2.4 进入fontawesome-free-5.0.13\web-fonts-with-css\webfonts 选中fa-solid-900.ttf

微信小程序引入Font Awesome-icon

fa-solid-900.ttf

2.5 上传完成后,按下图配置后,点击转换即可

微信小程序引入Font Awesome-icon

配置转换

2.6 转换完成,点击下载

微信小程序引入Font Awesome-icon

转换完成

2.7 解压,选择stylesheet.css文件

微信小程序引入Font Awesome-icon

选择stylesheet.css文件

2.8 将改文件重命名为: font-awesome.wxss

3 在app.wxss中引入该文件,并且增加fa样式

@import "/assets/css/icon/font-awesome.wxss";
.container {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 200rpx 0;
    box-sizing: border-box;
}

/*增加`fa`样式*/
.fa {
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    -moz-osx-font-smoothing: grayscale;
    -webkit-font-smoothing: antialiased;
    display: inline-block;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    line-height: 1;
}
复制代码

4 使用方式

<text class="fa fa-user"></text>
复制代码

5 样例:

微信小程序引入Font Awesome-icon

demo

6 注意,需要引入你要使用的icon的样式

微信小程序引入Font Awesome-icon
例如:
.fa-picture-o:before { 
    content: "\f03e"; 
}复制代码

---End---


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Single Page Web Applications

Single Page Web Applications

Michael Mikowski、Josh Powell / Manning Publications / 2013-9-30 / USD 44.99

Code for most web sites mostly runs on the server. When a user clicks on a link, the site reacts slowly because the browser sends information to the server and the server sends it back again before di......一起来看看 《Single Page Web Applications》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试