获取glyphicons.css的正确方法是什么?
问题描述:
我正在使用bootstrap 4.0。 4.0文档没有提到图标,但文档3.3。我希望有类似这样的图标按钮:获取glyphicons.css的正确方法是什么?
<button type="button" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-star" aria-hidden="true"></span> Star
</button>
我从3.3文档,但它不工作。我做了谷歌的解决方案(1,2等),做到这一点似乎是手动列出这样一个文件的方式:
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet">
不幸的是我无法找到一个4.0版本,但我不想在不知道发生了什么的情况下像这样添加它。为什么它不包含在bootstraps主页上的cdn链接中?我觉得你应该自己提供这个文件吗?但是我下载了bootstrap,并且它不在那里。
我缺少什么?我想要带有图标的按钮。
答
使用Font Awesome它真棒!
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<button type="button" class="btn btn-default btn-lg">
<span class="fa fa-star" aria-hidden="true"></span> Star
</button>
这应该工作得很好。
这里是所有图标列表:http://fontawesome.io/icons/
祝您好运!
+0
我喜欢和下一个人一样的字体,但我有问题。问题1,是自举批准的方式吗?问题2,我实际上需要像一个或两个图标。我讨厌把所有这些仅仅添加到一些可怜的图标上。问题3,版本仍然不匹配ಠ_ಠ – user875234
为什么不使用fontawesome http://fontawesome.io/ – vinsentos
查看[Docs](https://getbootstrap.com/docs/4.0/migration/#components),它们确实涵盖了Bootstrap 4图标的删除。所以使用任何有意义的东西如果您只需要一些图标,可以查看[Icomoon](https://icomoon.io/)或[Fontello](http://fontello.com/)。 – vanburen