如何在bootstrap 3.0中使用glyphicons

Shi*_*pta 86 html5 css3 twitter-bootstrap-3

我已经在bootstrap 2.3中使用了glyphicons,但现在我已升级到bootstrap 3.0.现在,我无法使用icon属性.

在bootstrap 2.3中,下面的标签正在工作

<i class="icon-search"></i>
Run Code Online (Sandbox Code Playgroud)

在bootstrap 3.0中,它不起作用.

Zim*_*Zim 107

图标(glyphicons)现在包含在一个单独的css文件中.

标记已更改为:

<i class="glyphicon glyphicon-search"></i>
Run Code Online (Sandbox Code Playgroud)

要么

<span class="glyphicon glyphicon-search"></span>
Run Code Online (Sandbox Code Playgroud)

以下是Bootstrap 3的一个有用的更改列表:http://bootply.com/bootstrap-3-migration-guide

  • 单独的css文件链接似乎被破坏了. (17认同)
  • 大家好,我做了同样的事情并跟进了结构,但没有得到正确的glyphicon ...显示一个未识别的0101型图像而不是glyphicon (5认同)

The*_*Guy 29

你去:

<i class="glyphicon glyphicon-search"></i>
Run Code Online (Sandbox Code Playgroud)

更多信息:

http://getbootstrap.com/components/#glyphicons

顺便说一句.您可以使用此转换工具,这也将更新图标的代码:


Emi*_*íaz 19

如果你下载一个自定义的bootstrap 3发行版,你必须:

  1. https://github.com/twbs/bootstrap/archive/v3.0.0.zip下载完整的发行版
  2. 解压缩并将调用的整个文件夹上传fonts到bootstrap目录.与其他文件夹"css,js"放在一起.

示例之前:

\css
\js
index.html
Run Code Online (Sandbox Code Playgroud)

上传后的示例:

\css
\fonts
\js
index.html
Run Code Online (Sandbox Code Playgroud)


ale*_*dro 6

如果你使用较少,并且没有加载图标字体,你必须检查字体路径转到文件variable.less并更改@ icon-font-path路径,这对我有用.