css - 如何在我的 ASP 应用程序中也包含 Bootstrap 字体目录?

标签 css asp.net asp.net-mvc twitter-bootstrap fonts

我正在运行 ASP5/MVC6。

我通过 bower 包含 Bootstrap,如下所示:

<link rel="stylesheet" type="text/css" href="~/lib/bootstrap/dist/css/bootstrap.css" />

运行我的应用程序时,使用字形字体的代码片段不起作用,例如:

<span class="glyphicon glyphicon-calendar"></span>

它只是显示一个空的矩形。

如果我使用 Chrome 来调试我的应用程序,我可以看到调试器的“源代码”选项卡中没有包含这些字体...那么我如何才能在我的网站中包含这些字体呢?

编辑:

我的 bootstrap.css 是默认的,所以它有:

@font-face {
  font-family: 'Glyphicons Halflings';

  src: url('../fonts/glyphicons-halflings-regular.eot');
  src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}

我的目录结构是这样的:

bootstrap-dir

最佳答案

更改您的 bootstrap.css,并确保字体源指向正确的目录:

@font-face {
  font-family: 'Glyphicons Halflings';

  src: url('../fonts/glyphicons-halflings-regular.eot');
  src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}

关于css - 如何在我的 ASP 应用程序中也包含 Bootstrap 字体目录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36342638/

相关文章:

javascript - javascript/jQuery 有没有办法永久存储数据?

c# - 请在字符串操作方面需要帮助

c# - 如何将 ASP.NET 成员/角色用户链接到数据库中的表?

c# - “Data.Repository.UnitofWork”未实现接口(interface)成员 'Data.Repository.IUnitofWork.Customer'

html - 如何将导航栏列表与正文列表分开?

php - mod_rewrite - RewriteRule - 重定向到不显示 css、图像等的索引

html - 使用 Bootstrap 的类似 Twitter 的推文框

javascript - 如何在隐藏时从 ASP.NET 验证中排除控件(显示 :none;)?

c# - 多选列表框asp mvc

c# - PayPal Error while Make Payment Using card 10752 错误消息