boostrap Glyphicons 字体问题

我按照网上的教程想要使用 boostrap Glyphicons,也拷贝fonts文件夹到目录下,下面是我的html文件,但是当我把fonts移到上一级目录就可以了,是为什么呢
sidebar.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="author" content="Quoniam">
    <title>SidebarMotion</title>
    <link rel="stylesheet" href="bootstrap.min.css">
    <script src="jquery-2.1.4.min.js"></script>
    <script src="bootstrap.min.js"></script>
</head>
<body>
    <div id="sidebar">
        <ul>
            <li class="item" id="prof">
                <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
                <div>我</div>
            </li>
        </ul>
    </div>
</body>
</html>

但是结果如下是为什么:
图片描述

我的文档结构

├── bootstrap.min.css
├── bootstrap.min.js
├── bootstrap-theme.min.css
├── fonts
│   ├── glyphicons-halflings-regular.eot
│   ├── glyphicons-halflings-regular.svg
│   ├── glyphicons-halflings-regular.ttf
│   ├── glyphicons-halflings-regular.woff
│   └── glyphicons-halflings-regular.woff2
├── jquery-2.1.4.min.js
└── sidebar.html
阅读 4.7k
3 个回答

因为看不到你的font-face的路径,目测你的目录结构错了,bootstrap.min.css默认是放在css目录下的,所以css文件中默认的font-face路径是../fonts/glyphicons-halflings-regular.xxx,所以尝试修改一下font-face的路径或者bootstrap.min.css文件放到css目录中

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题