Glyphicons Halflings Regular是一款流行的图标字体包,包含一系列精简风格的图标,适用于网页设计和开发中的各种界面元素。
为了在Bootstrap项目中显示Glyphicons图标所需的五个字体文件如下:
```css
@font-face {
font-family: Glyphicons Halflings;
src: url(..common/css/fonts/glyphicons-halflings-regular.eot);
src:
url(..common/css/fonts/glyphicons-halflings-regular.eot?#iefix) format(embedded-opentype),
url(..common/css/fonts/glyphicons-halflings-regular.woff2) format(woff2),
url(..common/css/fonts/glyphicons-halflings-regular.woff) format(woff),
url(..common/css/fonts/glyphicons-halflings-regular.ttf) format(truetype),
url(..common/css/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular)
format(svg);
}
.glyphicon {
position: relative;
top: 1px;
display: inline-block;
font-family: Glyphicons Halflings;
font-style: normal;
font-weight: normal;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
```
这段代码定义了如何通过不同格式(EOT, WOFF2, WOFF, TTF, SVG)加载Glyphicons Halflings字体,从而确保图标在各种浏览器中正确显示。同时设置了`.glyphicon`类的样式属性以保证图标的正常展示和布局效果。