html - Bootstrap 3 字形 CDN

标签 html css twitter-bootstrap cdn twitter-bootstrap-3

PAY ATTENTION!

The Bootstrap icons are back after this pull request merge.


After going back and forth on this for the last couple weeks, I've decided to restore the Glyphicons icon font to the main repo. Given how prevalent icons are in UIs, it's probably a disservice to most folks to not include them (or some other icon font) in the same spot as the CSS and JS.

With this update comes the following:

  • Restores documentation (on the Components page)
  • New variables, @icon-font-path and @icon-font-name, for flexibility in adding and removing icon fonts
  • Upgrades to latest Glyphicons (adding 40 new icons)
  • Removes the old Glyphicons mention from the CSS page

We'll work on improving the customization of icon fonts in the future so swapping font libraries can be easier (which was the whole motivation for the original removal).


新版Twitter Bootstrap Glyphicons 的CDN url 是哪个?

来自 Bootstrap 3 they were moved into a separate repository , 但我没有找到任何 CDN。

来自官方文档:

With the launch of Bootstrap 3, icons have been moved to a separate repository. This keeps the primary project as lean as possible, makes it easier for folks to swap icon libraries, and makes Glyphicons icon fonts more readily available to more people outside Bootstrap.

关于official website他们不提供图标的 CDN 网址。

在哪里可以找到?我不想下载存储库并将其包含到我的元素中。

最佳答案

随着最近release of bootstrap 3 ,并且字形被合并回主要的 Bootstrap 存储库,Bootstrap CDN现在提供完整的 Bootstrap 3.0 css,包括 Glyphicons。 Bootstrap css 引用是您需要包括的全部内容:Glyphicons 及其依赖项位于 CDN 站点的相对路径上,并在 bootstrap.min.css 中引用。

在 html 中:

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">

在 CSS 中:

 @import url("//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css");

这是一个有效的 demo .

注意您必须使用.glyphicon 类而不是.icon:

例子:

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

另请注意,您仍然需要包含 bootstrap.min.js 以使用 Bootstrap JavaScript 组件,请参阅 Bootstrap CDN用于网址。


如果您想单独使用 Glyphicons,您可以通过直接引用 Bootstrap CDN 上的 Glyphicons css 来实现。 .

在 html 中:

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet">

在 CSS 中:

@import url("//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css");

由于 css 文件已经包含了所有需要的 Glyphicons 依赖项(它们位于 Bootstrap CDN 站点的相对路径中),添加 css 文件就可以了开始使用 Glyphicons。

这是一个有效的 demo没有 Bootstrap 的 Glyphicons。

关于html - Bootstrap 3 字形 CDN,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18222849/

相关文章:

javascript - jQuery click() 在 "for"内循环触发一次

javascript - dojo 网格在 div 内不起作用

css - 使用 translateX/Y 垂直和水平居中未按预期工作

html - NReco imagegenerator 无法正确写入条形码

jquery - 使用搜索按钮制作响应式导航栏

html - 使用 font-awesome 将小图标堆叠在大图标上

html - 如何使滚动条仅适用于选项卡,而不适用于内容?

html - 正确设置标题...图像向右浮动 h1 标题

查询。突出显示表格单元格

javascript - 图像 slider 不允许在移动 View 中下拉导航栏