twitter-bootstrap 如何在 3.0.0 中使用 Bootstrap Glyphicons?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18310104/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 18:01:09  来源:igfitidea点击:

How do I use Bootstrap Glyphicons in 3.0.0?

twitter-bootstrapiconsglyphicons

提问by Robert Andrews

I'm using Glyphicons in Bootstrap. I was calling in the CSS straight from http://glyphicons.getbootstrap.com/css/bootstrap-glyphicons.cssbut this has now disappeared and was not recommended.

我在 Bootstrap 中使用 Glyphicons。我是直接从http://glyphicons.getbootstrap.com/css/bootstrap-glyphicons.css调用 CSS 的,但现在已经消失了,不推荐使用。

This apparently coincides with Twitter making the Glyphicons available in the Bootstrap package again. I am using Bootstrap 3.0.0 RC1 or RC2.

这显然与 Twitter 再次在 Bootstrap 包中提供 Glyphicons 相吻合。我正在使用 Bootstrap 3.0.0 RC1 或 RC2。

My problem: I have no idea how to use the icons in my own hosting... Seems to me the code is contained within the bootstrap.css (?). I have uploaded the "fonts" directory but am only getting blank, empty-box icons where there should be proper icons.

我的问题:我不知道如何在自己的主机中使用图标...在我看来,代码包含在 bootstrap.css (?) 中。我已经上传了“字体”目录,但在应该有适当图标的地方只得到空白的空框图标。

Any ideas please? What should be where and how should it be called?

请问有什么想法吗?应该在哪里以及如何称呼它?

回答by David Lemayian

The bootstrap-glyphicons.cssfile seems to have been removed with the final\production Bootstrap 3.0.0. Simply download the zip from http://getbootstrap.com/and then copy the dist/css/bootstrap.min.cssfile in your css folder. You should then include it in your HTML page as such:

bootstrap-glyphicons.css文件似乎已被最终\生产 Bootstrap 3.0.0 删除。只需从http://getbootstrap.com/下载 zip ,然后将dist/css/bootstrap.min.css文件复制到您的 css 文件夹中。然后,您应该将它包含在您的 HTML 页面中,如下所示:

<!DOCTYPE html>
<html>
  <head>
    <title>Bootstrap 101 Glyphicons</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!-- Bootstrap CSS file -->
    <link href="css/bootstrap.min.css" rel="stylesheet" media="screen">

  </head>
  <body>

    <!-- Glyphicon in a H1 tag -->
    <h1>Hello, <span class="glyphicon glyphicon-globe"></span> !</h1>

  </body>
</html>

Source: http://getbootstrap.com/getting-started/

来源:http: //getbootstrap.com/getting-started/

回答by mrkre

If you have already put in the fonts directory, calling the icons now would be <span class="glyphicon glyphicon-pencil"></span>instead of <i class="icon-large icon-pencil"></i>.

如果您已经放入了 fonts 目录,那么现在调用图标将是<span class="glyphicon glyphicon-pencil"></span>而不是<i class="icon-large icon-pencil"></i>.

回答by user3807820

Just make sure your fonts folder is placed correctly relative to the .css file: ../fonts

只需确保您的字体文件夹相对于 .css 文件正确放置: ../fonts

some-root-folder
├--my-css-folder
|  └--bootstrap.min.css
└--fonts
   └--glyphicons-halflings-regular.ttf

回答by Nelson Patricio Jimenez

I followed this post http://www.erikminkel.com/2013/09/01/twitter-bootstrap-3-in-a-rails-4-application. I don't know if the best way, but Works.

我关注了这篇文章http://www.erikminkel.com/2013/09/01/twitter-bootstrap-3-in-a-rails-4-application。我不知道是否是最好的方法,但有效。