引导 3 个字形直到我放大和缩小才会显示


Bootstrap 3 glyphicons not showing until I zoom in and out

由于某种原因,字形图标无法在我的Chrome或Firefox上正确加载,但是它们似乎在IE上工作得很好(没有测试太多次,也许只是幸运)。

在我放大/缩小之前,字形图标不会显示在我的页面上。即使放大或缩小 10% 也会使它们出现,当我恢复到正常大小 (100%) 时,它们仍然存在。但是,首次加载页面时我看不到它们。

我正在从引导页面测试以下模板:

http://getbootstrap.com/examples/carousel/

我所做的只是用字形替换了 140x140 的标题图像,并使用简单的示例代码将它们调整为 90 像素:

span.glyphicon-globe {
font-size: 80px;
color: #EA8A46;
}

这是我如何使用它们:

<div class="col-lg-4">
  <span class="glyphicon glyphicon-star-empty"></span>
  <h2>Test</h2>
  <p>Vestibulum id ligula porta felis euismod semper. Praesent commodo cursus magna, vel scelerisque nisl consectetur. Fusce dapibus, tellus ac cursus commodo.</p>
  <p><a class="btn btn-warning" href="#" role="button">więcej &raquo;</a></p>
</div><!-- /.col-lg-4 -->
<div class="col-lg-4">
  <span class="glyphicon glyphicon-calendar"></span>
  <h2>Test 2</h2>
  <p>Vestibulum id ligula porta felis euismod semper. Praesent commodo cursus magna, vel scelerisque nisl consectetur. Fusce dapibus, tellus ac cursus commodo.</p>
  <p><a class="btn btn-warning" href="#" role="button">więcej &raquo;</a></p>
</div><!-- /.col-lg-4 -->
<div class="col-lg-4">
  <span class="glyphicon glyphicon-check"></span>
  <h2>Test 3</h2>
  <p>Vestibulum id ligula porta felis euismod semper. Praesent commodo cursus magna, vel scelerisque nisl consectetur. Fusce dapibus, tellus ac cursus commodo.</p>
  <p><a class="btn btn-warning" href="#" role="button">więcej &raquo;</a></p>
</div><!-- /.col-lg-4 -->

模板上有这样的注释:

Note: If you're viewing this page via a file:// URL, the "next" and "previous" Glyphicon buttons on the left and right might not load/display properly due to web browser security rules.

但是我没有将其与file://一起使用.问题存在于本地主机和实时服务器上。我没有在引导页面上使用定制器,字体来自标准.zip文件。

如果您需要更多代码,我很乐意提供。

编辑:刚刚使用新安装的IE和Firefox进行了更多测试,一切正常。可能只是铬吗?

检查字体是否正确引用。这是通过引导程序上的自定义下载选项下载时注意到的问题。

@font-face {
  font-family: 'Glyphicons Halflings';
  src: url('Content/fonts/glyphicons-halflings-regular.eot');
  src: url('Content/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded- opentype'), url('Content/fonts/glyphicons-halflings-regular.woff') format('woff'), url('Content/fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('Content/fonts/glyphicons-halflings-regular.svg#glyphicons-halflingsregular') format('svg');
}

如果没有,您也可以尝试使用 cdn。小提琴