1

我想看看这个:

两个箭头

当我在<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>

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

一切都搞砸了

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

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

编辑:

这是我的文件夹结构:

文件夹结构

html 文档被调用demo.html并位于文件夹A2( http://localhost/573/A2/demo.html ) 中。CSS 样式表是A2/css/fontello_mod.css.

4

3 回答 3

2

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

那么你必须把“../”像:

url('../font/fontello.eot?47332372');
于 2016-04-04T05:31:02.280 回答
1

您的css文件未获取该font文件夹。将“fontello”字体文件夹放在该css文件夹中。

于 2016-04-04T05:32:57.157 回答
1

将所有字体网址更改为

@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;

}

于 2016-04-04T06:05:34.393 回答