• iconfont的引入方法


    第一步:使用font-face声明字体
    @font-face {font-family: 'iconfont';
    src: url('iconfont.eot'); /* IE9*/
    src: url('iconfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
    url('iconfont.woff') format('woff'), /* chrome、firefox */
    url('iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
    url('iconfont.svg#iconfont') format('svg'); /* iOS 4.1- */
    }
    第二步:定义使用iconfont的样式
    <pre>
    .iconfont{
    font-family:"iconfont" !important;
    font-size:16px;font-style:normal;
    -webkit-font-smoothing: antialiased;
    -webkit-text-stroke- 0.2px;
    -moz-osx-font-smoothing: grayscale;}
    第三步:挑选相应图标并获取字体编码,应用于页面
    <i class="iconfont">&#xe601;</i>

    代码HTML

    <!doctype html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>icon</title>
        <link rel="stylesheet" href="css/iconfont.css">
    </head>
    <style>
        i:nth-of-type(1){
            font-size: 100px;
            color: #333;
        }
        i:nth-of-type(2){
            font-size: 200px;
            color: #1a1a1a;
            line-height: 300px;
        }
    </style>
    <body>
        <i class="iconfont">&#xf00a5;</i>
        <i class="iconfont">&#xe601;</i>
        <i class="iconfont">&#xe6bf;</i>
        <i class="iconfont">&#xe659;</i>
    </body>
    </html>

    css

    @font-face {font-family: "iconfont";
      src: url('iconfont.eot?t=1471336647'); /* IE9*/
      src: url('iconfont.eot?t=1471336647#iefix') format('embedded-opentype'), /* IE6-IE8 */
      url('iconfont.woff?t=1471336647') format('woff'), /* chrome, firefox */
      url('iconfont.ttf?t=1471336647') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
      url('iconfont.svg?t=1471336647#iconfont') format('svg'); /* iOS 4.1- */
    }
    
    .iconfont {
      font-family:"iconfont" !important;
      font-size:16px;
      font-style:normal;
      -webkit-font-smoothing: antialiased;
      -webkit-text-stroke- 0.2px;
      -moz-osx-font-smoothing: grayscale;
    }
    .icon-nav:before { content: "f00a5"; }
    .icon-nav1:before { content: "e601"; }
    .icon-nav2:before { content: "e608"; }
    .icon-nav3:before { content: "e6bf"; }
    .icon-nav4:before { content: "e659"; }
    

      字体下载之后放在css文件下面

  • 相关阅读:
    可方便扩展的JIRA Rest Web API的封装调用
    小诗一首
    jxse2.6在jdk8下,JxtaMulticastSocket存在的问题
    http://blogs.msdn.com/b/pranavwagh/archive/2007/03/03/word-2007-file-seems-to-be-deleted-when-you-open-and-save-it-using-dsoframer.aspx
    how to javafx hide background header of a tableview?
    Styling FX Buttons with CSS
    2d网络游戏的延迟补偿(Lag compensation with networked 2D games)
    Fast-paced Multiplayer
    jspace2d——A free 2d multiplayer space shooter
    JXSE and Equinox Tutorial, Part 2
  • 原文地址:https://www.cnblogs.com/wangshuyi/p/6686653.html
Copyright © 2020-2023  润新知