bootstrap中怎么引用fonts

这篇文章将为大家详细讲解有关bootstrap中怎么引用fonts,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。

只需要建一个fonts文件夹放在和js,css文件同级目录下,就可以正确引用。

关键是下面这几个文件得有:

glyphicons-halflings-regular.eotglyphicons-halflings-regular.svgglyphicons-halflings-regular.ttfglyphicons-halflings-regular.woff

相关的 CSS 规则写在 dist 文件夹内的 css 文件夹内的 bootstrap.css 和 bootstrap-min.css 文件上。

字体文件的路径请灵活改变

<style type="text/css">        @font-face {            font-family: 'Glyphicons Halflings';            src: url('font/glyphicons-halflings-regular.eot');            src: url('font/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'),             url('font/glyphicons-halflings-regular.woff') format('woff'),             url('font/glyphicons-halflings-regular.ttf') format('truetype'),             url('fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');        }</style>

所以 font-face 规则实际上是在找到 glyphicons 地方声明 font-family 和位置。

关于bootstrap中怎么引用fonts就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。