iconfont、webfont的使用

代码:

一、iconfont demo

<!DOCTYPE html>

<html>

    <head>
        <meta charset="utf-8" />
        <title>IconFont</title>
        <style type="text/css">
            @font-face {
                font-family: "iconfont";
                src: url('font/iconfont.eot?t=1466407979');
                /* IE9*/
                src: url('font/iconfont.eot?t=1466407979#iefix') format('embedded-opentype'), /* IE6-IE8 */
                url('font/iconfont.woff?t=1466407979') format('woff'), /* chrome, firefox */
                url('font/iconfont.ttf?t=1466407979') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
                url('font/iconfont.svg?t=1466407979#iconfont') format('svg');
                /* iOS 4.1- */
            }

            .iconfont {
                font-family: "iconfont" !important;
                font-size: 66px;
                font-style: normal;
                -webkit-font-smoothing: antialiased;
                -webkit-text-stroke-width: 0.2px;
                -moz-osx-font-smoothing: grayscale;
            }
        </style>
    </head>

    <body>
        <i class="icon iconfont">&#xe632;</i>

    </body>

</html>

demo下载

使用方法:
1、下载需要的图标字体并解压。
2、将下载的四个字体文件替换demo中的文件。
3、替换demo中的css,修改body中的类名即可。
注意点:font文件的引入,URL路径填写是否正确。

二、webfont使用demo

<!doctype html>
<html lang="en">

    <head>
        <meta charset="UTF-8" />
        <title>Document</title>
        <style type="text/css">
            @font-face {
                font-family: 'webfont';
                src: url('//at.alicdn.com/t/gscufddwstmuc8fr.eot');
                /* IE9*/
                src: url('//at.alicdn.com/t/gscufddwstmuc8fr.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
                url('//at.alicdn.com/t/gscufddwstmuc8fr.woff') format('woff'), /* chrome、firefox */
                url('//at.alicdn.com/t/gscufddwstmuc8fr.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
                url('//at.alicdn.com/t/gscufddwstmuc8fr.svg#思源黑体-极细') format('svg');
                /* iOS 4.1- */
            }

            .web-font {
                font-family: "webfont" !important;
                font-size: 60px;
                font-style: normal;
                -webkit-font-smoothing: antialiased;
                -webkit-text-stroke-width: 0.2px;
                -moz-osx-font-smoothing: grayscale;
            }
        </style>
    </head>

    <body>

        <p class="web-font">人才皆以不问出身,但是不能没有标准。</p>

    </body>

</html>

使用方法:
1、将希望改变的字体复制粘贴到webfont 点击生成,然后复制引用线上地址替换原来的@font-face和body中的字体即可。
2、注意命名。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值