图标字体(@ font-face)无法在localhost上呈现

时间:2012-12-14 21:55:43

标签: css permissions nginx icons font-face

我的locahost以及我的mysite.com都有font-awesome icon-font,它们都是nginx服务器。奇怪的是,当我尝试从Glyphicons实现类似的图标字体集时,图标仅在mysite.com上呈现,但在我的本地主机上不是

这些图标通常与他们在本地主机上的显示方式相似:

正常: normal 破坏: busted

问题是我的localhost上没有识别font-family: 'Glyphicons'属性,因为只需在mysite.com上注释掉font CSS属性就会重新创建红框外观:

.glyphicons i::before {
  position: absolute;
   left: 0;
  top: 0;
  font: 24px/1em 'Glyphicons'; // commenting out this line re-creates the red box pattern
  font-style: normal;
  color: #1D1D1B;
  color: red;
 }

1 个答案:

答案 0 :(得分:2)

我要感谢@David(见上面的评论)帮助我回答我自己的问题。该问题是文件权限问题。我刚刚将Glyphicons文件夹添加到我的localhost应用程序文件夹(即/ html),但它没有正确的权限。只需在命令行中键入以下内容即可解决问题:

html TimPeterson$ chmod -R 777 assets/glyphicons/   /*this command allows access to all (777) for all files and folders (-R) within the glyphicons folder*/ 

所以不像我原先想的那样,不是CSS,mime-types或其他与Nginx有关的事情。