我有font-awesome icon-font 在我的 locahost 和 mysite.com 上工作,它们都是 nginx 服务器。奇怪的是,当我尝试从 Glyphicons 实现类似的图标字体集时这些图标仅在 mysite.com 上呈现,但不在我的本地主机上呈现。
以下是图标的正常外观与它们在本地主机上的外观:
正常: 查获:
问题是我的本地主机无法识别 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;
}
最佳答案
我要感谢@David(请参阅上面的评论)帮助我回答我自己的问题。该问题是文件权限问题。我刚刚将 Glyphicons 文件夹添加到本地主机应用程序文件夹(即/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 有关的东西,正如我最初想象的那样。
关于css - 图标字体(@font-face)未在本地主机上呈现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13886817/