无法链接到fontello

时间:2016-04-04 05:24:47

标签: html css glyphicons fontello

我想看到这个:

two arrows

当我在<style></style>标签之间包含修改后的fontello CSS时,它可以正常工作:

<!DOCTYPE html>
<html>

    <head>
        <meta charset="UTF-8">
        <!-- <link rel="stylesheet" type="text/css" href="css/fontello_mod.css"/> -->
    </head>

<style>

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

.icon {
    font-family: "fontello";
    font-style: normal;
    font-weight: normal;
    speak: none;

    display: inline-block;
    text-decoration: inherit;
    width: 1em;
    margin-right: .2em;
    text-align: center;
    /* opacity: .8; */

    /* For safety - reset parent styles, that can break glyph codes*/
    font-variant: normal;
    text-transform: none;

    /* fix buttons height, for twitter bootstrap */
    line-height: 1em;

    /* Animation center compensation - margins should be symmetric */
    /* remove if not needed */
    margin-left: .2em;

    /* You can be more comfortable with increased icons size */
    font-size: 220%;

    /* Font smoothing. That was taken from TWBS */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

}

</style>

    <body>
        <i class="icon">&#xe800;</i><i class="icon">&#xe801;</i>
    </body>
</html>

因为一切似乎都很好,我将CSS移动到外部工作表并删除了<style></style>位:

<!DOCTYPE html>
<html>

    <head>
        <meta charset="UTF-8">
        <link rel="stylesheet" type="text/css" href="css/fontello_mod.css"/>
    </head>

<!-- <style></style> -->

    <body>
        <i class="icon">&#xe800;</i><i class="icon">&#xe801;</i>
    </body>
</html>

但现在,我的图标看起来像这样:

all messed up

两者之间的CSS相同(复制和粘贴)。为什么会这样?我该如何解决?

我不确定它是否相关,但我现在正在使用Chrome和XAMPP(仅限Apache)。

编辑:

这是我的文件夹结构:

folder structure

html文档名为demo.html,位于A2http://localhost/573/A2/demo.html)文件夹中。 CSS样式表为A2/css/fontello_mod.css

3 个答案:

答案 0 :(得分:2)

如果您将代码移动到外部源,请检查字体文件的路径。

然后你必须把“../”改为:

url('../font/fontello.eot?47332372');

答案 1 :(得分:1)

您的css文件未获取font文件夹。 放置你的&#34; fontello&#34; css文件夹中的字体文件夹。

答案 2 :(得分:1)

将所有字体网址更改为

favorites

}