【问题标题】:how to solve webfont problems如何解决网络字体问题
【发布时间】:2015-09-22 20:15:31
【问题描述】:

我在我的项目中使用 Bootstrap.css 和 font-awesome.css 以及 cdn 链接。 例如: 对于引导程序

<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootswatch/3.3.0/cerulean/bootstrap.min.css">

字体真棒

 <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">

在我的代码中,我使用 class="glyphicon glyphicon-search" 等。它工作正常。 但是当我从相同的链接下载css文件时。并在本地添加依赖项,它没有运行。错误说

 GET http://localhost:8451/ProntoDemo/resources/fonts/glyphicons-halflings-regular.woff 
 GET http://localhost:8451/ProntoDemo/resources/fonts/glyphicons-halflings-regular.ttf 404 (Not Found)

我不明白问题出在哪里。请帮我在本地运行。 喜欢

<link rel="stylesheet" href="./resources/css/bootstrap.min.css">

【问题讨论】:

  • 你能具体说明你是如何修改你的吗css
  • 您收到 404 错误 - 找不到文件。检查您的日志以查看您的 url 解析到的文件路径。
  • 我在我的项目目录中创建 bootstrp.min.css 文件并将其添加到我的 html 页面中。

标签: html css twitter-bootstrap webfonts


【解决方案1】:

由于字体文件带有捆绑包,因此它们具有包含字体的 ttf(真字体)文件。所以你需要下载 zip 并解压到你的服务器然后只有你可以链接 css 文件..

<link rel="stylesheet" href="Fonts/font-awesome-4.4.0/css/font-awesome.min.css">

链接https://fortawesome.github.io/Font-Awesome/

【讨论】:

  • 解压到你的服务器是解压并复制IDE项目目录下的文件??
  • 是的@Subho,到你的服务器意味着解压并复制IDE项目目录中的文件
  • 感谢@Rohit 的支持。但是我为我的问题找到了另一种解决方案。在下载的 bootstrap.css 中有 src:url('../fonts/glyphicons-halflings-regular.eot').. 但在我的项目目录中,我创建的是字体而不是字体。我只是改变它。 font-awesome 也一样。
猜你喜欢
  • 1970-01-01
  • 2019-12-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-10
  • 1970-01-01
  • 1970-01-01
  • 2012-06-03
相关资源
最近更新 更多