【问题标题】:font-family is not working in css although the structure is ok尽管结构没问题,但 font-family 在 css 中不起作用
【发布时间】:2017-02-04 17:57:02
【问题描述】:

我在网站中使用以下结构:

    • 主题
      • index.html
    • 资产
      • 我的字体
        • CSS
          fontiran.cssstyle.css
        • 字体
          IRANSansWeb.eotIRANSansWeb.woffIRANSansWeb.woff2IRANSansWeb.ttf

内容是:

index.html:

[...]
<link href="../assets/myfont/css/style.css" rel="stylesheet">
[...]

style.css:

@import url(fontiran.css);
body {
    font-family: IRANSans !important;
}

fontiran.css:

@font-face {
    font-family: IRANSans;
    font-style: normal;
    font-weight: normal;
    src: url('../fonts/IRANSansWeb.eot');
    src: url('../fonts/IRANSansWeb.eot?#iefix') format('embedded-opentype'),
         url('../fonts/IRANSansWeb.woff2') format('woff2'),
         url('../fonts/IRANSansWeb.woff') format('woff'),
         url('../fonts/IRANSansWeb.ttf') format('truetype');
}

但该字体在网站上不起作用。 FontFinderfirefox 插件显示:

Font
===============================
font-family (stack): IRANSans
Font being rendered: System Default
font-size: 13px

但它没有被使用。究竟是什么问题?

【问题讨论】:

    标签: html css fonts font-face


    【解决方案1】:

    【讨论】:

    • ttf、woff 和 woff2 包含在 [Other types] 中。出于可读性原因,我跳过了它们。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-01
    • 2021-07-22
    • 2019-11-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多