• css: 使用unicode方式引入iconfont图标


    Unicode 是字体在网页端最原始的应用方式,特点是:

    • 兼容性最好,支持 IE6+,及所有现代浏览器。
    • 支持按字体的方式去动态调整图标大小,颜色等等。
    • 但是因为是字体,所以不支持多色。只能使用平台里单色的图标,就算项目里有多色图标也会自动去色。

    注意:新版 iconfont 支持多色图标,这些多色图标在 Unicode 模式下将不能使用,如果有需求建议使用symbol 的引用方式

    在需要引用的样式里复制代码:

    @font-face {
        font-family: 'iconfont';
        src: url('//static.fczx.com/www/assets/font/iconfont.eot');
        src: url('//static.fczx.com/www/assets/font/iconfont.eot?#iefix') format('embedded-opentype'), 
        url('//static.fczx.com/www/assets/font/iconfont.woff2') format('woff2'), 
        url('//static.fczx.com/www/assets/font/iconfont.woff') format('woff'), 
        url('//static.fczx.com/www/assets/font/iconfont.ttf') format('truetype'), 
        url('//static.fczx.com/www/assets/font/iconfont.svg#iconfont') format('svg');
    }
    
    .iconfont {
        font-family: 'iconfont';
        display: inline-block;
        text-align: center;
        font-style: normal;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    @font-face {
      font-family: "iconfont logo";
      src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834');
      src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834#iefix') format('embedded-opentype'),
        url('https://at.alicdn.com/t/font_985780_km7mi63cihi.woff?t=1545807318834') format('woff'),
        url('https://at.alicdn.com/t/font_985780_km7mi63cihi.ttf?t=1545807318834') format('truetype'),
        url('https://at.alicdn.com/t/font_985780_km7mi63cihi.svg?t=1545807318834#iconfont') format('svg');
    }
    
    .logo {
      font-family: "iconfont logo";
      font-size: 160px;
      font-style: normal;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
    }

    Nginx跨域设置:

    location / {
                root   D:codestatic;
                index  index.html index.htm;
                add_header Access-Control-Allow-Origin *;
            }

    html使用:

    <i class="iconfont">&#xeb97;</i>
  • 相关阅读:
    SQL Server 判断各种对象是否存在和sysobjects的关系
    SQL Server 通过“with as”方法查询树型结构
    js Iframe与父级页面通信及IE9-兼容性
    SQL Server Update 链接修改和when的应用
    C# 使用表达式树获取特性的值
    .Net Core 防止跨站点请求伪造
    SQL Server 待定
    C# Http请求
    C# Linq 笛卡尔积
    SQL Server 存储过程、函数、触发器的定义
  • 原文地址:https://www.cnblogs.com/Nyan-Workflow-FC/p/13359435.html
Copyright © 2020-2023  润新知