Bootstrap 缺少字形
Bootstrap glyphicons are missing
我不知道为什么,但是我在 Bootstrap (3.3.7) 中的字形不见了,它们被一个普通且丑陋的正方形所取代。以下是调用缺失字形的代码示例:
<button type="button" class="btn btn-default">
<span class="glyphicon glyphicon-star" aria-hidden="true"></span> Star
</button>
这里是包含字形字体的 Bootstrap 部分:
@font-face {
font-family: 'Glyphicons Halflings';
src: url('../fonts/glyphicons-halflings-regular.eot');
src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}
您需要更新它,使用 cdn link,将其添加到您的代码中
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
您需要在linkhttps://getbootstrap.com/docs/4.5/getting-started/download/中下载Bootstrap,下载后您需要将字体放入您的项目中。新版Bootstrap包里没有字体,旧版可以下载。
我不知道为什么,但是我在 Bootstrap (3.3.7) 中的字形不见了,它们被一个普通且丑陋的正方形所取代。以下是调用缺失字形的代码示例:
<button type="button" class="btn btn-default">
<span class="glyphicon glyphicon-star" aria-hidden="true"></span> Star
</button>
这里是包含字形字体的 Bootstrap 部分:
@font-face {
font-family: 'Glyphicons Halflings';
src: url('../fonts/glyphicons-halflings-regular.eot');
src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}
您需要更新它,使用 cdn link,将其添加到您的代码中
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
您需要在linkhttps://getbootstrap.com/docs/4.5/getting-started/download/中下载Bootstrap,下载后您需要将字体放入您的项目中。新版Bootstrap包里没有字体,旧版可以下载。