下面的代码不会调用下载文件。我在Node.js和Express框架中使用它。

@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.woff') format('woff'),
       url('../../fonts/glyphicons-halflings-regular.ttf') format('truetype'),
       url('../../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}


上面的代码应该在浏览器中下载glyphicon字体,但并非如此。在Chrome和Firefox的开发人员工具栏中,我看不到对指定URL的任何调用。

有人可以解释为什么

最佳答案

字体文件只有在使用它们后才会加载。
我试图加载glyphicon字体,但是我没有在html中使用它们。因此,它没有被加载。

09-16 22:49