我已经在Bootstrap 2.3中使用了glyphicons,但现在我已经升级到Bootstrap 3.0,无法使用图标属性。
在Bootstrap 2.3中,以下标签有效。
<i class="icon-search"></i>
在Bootstrap 3.0中,它没有起作用。
我已经在Bootstrap 2.3中使用了glyphicons,但现在我已经升级到Bootstrap 3.0,无法使用图标属性。
在Bootstrap 2.3中,以下标签有效。
<i class="icon-search"></i>
在Bootstrap 3.0中,它没有起作用。
图标(glyphicons)现在包含在一个单独的CSS文件中。
标记已更改为:
<i class="glyphicon glyphicon-search"></i>
或者<span class="glyphicon glyphicon-search"></span>
以下是 Bootstrap 3 的一份有用的变更列表:http://bootply.com/bootstrap-3-migration-guide
就是这样:
<i class="glyphicon glyphicon-search"></i>
更多信息:
http://getbootstrap.com/components/#glyphicons
Btw. 你可以使用这个转换工具,它还会更新图标的代码:
如果您下载了自定义的 Bootstrap 3 发行版,则必须:
fonts
的整个文件夹到您的 Bootstrap 目录中,并与其他文件夹“css,js”放在一起。示例 Before:
\css
\js
index.html
上传后的示例:
\css
\fonts
\js
index.html
如果你在使用less时,遇到了图标字体无法加载的问题,那么你需要检查一下字体文件的路径。前往文件variable.less,并更改@icon-font-path的路径即可解决该问题。
Bootstrap 3需要使用标签而不是标签。
<span class="glyphicon glyphicon-search"></span>`
如果您正在使用grunt构建应用程序,则可能在构建过程中路径会发生变化。在这种情况下,您需要像这样修改grunt文件:
copy: {
main: {
files: [{
src: ['fonts/**'],
dest: 'dist/fonts/',
filter: 'isFile',
expand: true,
flatten: true
}, {
src: ['bower_components/font-awesome/fonts/**'],
dest: 'dist/css/',
filter: 'isFile',
expand: true,
flatten: false
}]
}
},
包含字体 将所有字体文件复制到靠近CSS的/fonts目录中。
<span class="glyphicon glyphicon-ok"></span>
<style type="text/css">
@font-face {
font-family: 'Glyphicons Halflings';
src: url('/fonts/glyphicons-halflings-regular.eot');
}
</style>
这可能会有所帮助。它包含许多示例,对于理解将非常有用。
http://www.w3schools.com/bootstrap/bootstrap_ref_comp_glyphs.asp
解决方案
,但都不适用于我。 - Andrew_1510