【问题标题】:how to use custom fonts and icons in codeigniter如何在 codeigniter 中使用自定义字体和图标
【发布时间】:2016-02-15 12:08:51
【问题描述】:

猛击所有人 我想在我的视图中使用来自 flaticon.com 的自定义图标 http://successpermis.com/css/flaticon.html 中的图标 作为 html 它工作正常,但是当我在视图中使用它时它不起作用 我认为加载字体的问题

    @font-face {
    font-family: "Flaticon";
    src: url("http://successpermis.com/css/flaticon.eot");
    src: url("http://successpermis.com/css/flaticon.eot#iefix") format("embedded-opentype"),
    url("http://successpermis.com/css/flaticon.woff") format("woff"),
    url("http://successpermis.com/css/flaticon.ttf") format("truetype"),
    url("http://successpermis.com/css/flaticon.svg") format("svg");
    font-weight: normal;
    font-style: normal;
}

我尝试从本地文件夹然后从在线主机加载字体,就像上面的代码一样 你能告诉我以正确的方式去做吗

【问题讨论】:

标签: php codeigniter icons


【解决方案1】:

文件夹结构

- application
- assets
    - css 
    - js
    - images
    - fonts

style.css

  @font-face {
        font-family: "Flaticon";
        src: url("assets/fonts/flaticon.eot");

        -------------
    }

【讨论】:

  • 如果您能详细说明一下细节会很棒,为什么您认为这有助于 OP 解决他的问题。
【解决方案2】:

  

@font-face {
    font-family: "Flaticon";
    src: url("http://successpermis.com/css/flaticon.eot");
    src: url("http://successpermis.com/css/flaticon.eot#iefix") format("embedded-opentype"),
    url("<?php echo base_url('assets/fonts/flaticon.woff')?>") format("woff"),
    url("<?php echo base_url('assets/fonts/flaticon.tff')?>") format("truetype"),
    url("<?php echo base_url('assets/fonts/flaticon.svg')?>") format("svg");
    font-weight: normal;
    font-style: normal;
}

【讨论】:

  • 感谢您提供此代码 sn-p,它可能会提供一些有限的即时帮助。 proper explanation 将通过展示为什么这是解决问题的好方法,并使其对有其他类似问题的未来读者更有用,从而大大提高其长期价值。请edit您的回答添加一些解释,包括您所做的假设。
猜你喜欢
  • 2023-04-03
  • 2013-12-28
  • 2021-07-23
  • 2018-10-08
  • 2019-02-21
  • 2015-05-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多