在我的应用程序中,我使用了不同的字体和bootstrap的glyphen图标。 要在所有浏览器中查看结果,我已将所有必需的字体类型(woff,tft,svg,..)放在font-face中。 对于引导图标,我只是将必要的类型放在字体文件夹中。无法在浏览器Chrome和IE中加载资源
如果我去本地主机,一切工作正常。在所有浏览器中,我可以看到结果。
但是现在我在真正的服务器上部署了我的应用程序(战争)。 在fireFox中,我仍然可以看到图标和字体,但不能在Chrome和IE中看到。 在那里,我得到控制台以下错误:
http://myTestServer.com/admin-UI/fonts/source-sans-pro/Source_Sans_Pro_400.woff Failed to load resource: the server responded with a status of 500 (Internal Server Error)
...
GET http://myTestServer.com/admin-UI/fonts/glyphicons-halflings-regular.woff2
GET http://myTestServer.com/admin-UI/fonts/glyphicons-halflings-regular.woff
GET http://myTestServer.com/admin-UI/fonts/glyphicons-halflings-regular.ttf
我不明白,为什么它的工作原理地方,而不是真实的服务器上。 有人知道这个问题吗?
我的CSS:
@font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 300;
src: url('../fonts/source-sans-pro/Source_Sans_Pro_300.eot');
src: url('../fonts/source-sans-pro/Source_Sans_Pro_300.eot?#iefix') format('embedded-opentype'),
url('../fonts/source-sans-pro/Source_Sans_Pro_300.woff') format('woff'),
url('../fonts/source-sans-pro/Source_Sans_Pro_300.ttf') format('truetype'),
url('../fonts/source-sans-pro/Source_Sans_Pro_300.svg#SourceSansPro') format('svg');
谢谢!
UPDATE:
前的index.html(春季启动的本地主机服务器才做):
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
后(这部作品在Tomcat和也myServer上)的index.html
<!-- Bootstrap Core CSS - tomcat-->
<link href="http://localhost:8080/adminUI/css/bootstrap.min.css" rel="stylesheet">
<!-- Bootstrap Core CSS -myTestServer-->
<link href="http://myTestServer.com/adminUI/css/bootstrap.min.css" rel="stylesheet">
main.css我也加了绝对路径。我的问题是,现在有没有办法来取代绝对路径:“http://..../”与一个变量。
如果我使用的是相似的路径,那就像在开始时一样。 我希望你明白我的意思。
使用绝对路径在css中包含字体文件 – Khurram
关于引导程序字体文件?他们是否也必须在CSS?我以为引导程序会自动在字体文件夹中找到它们。我应该如何命名bootstrap的字体,以便检测文件? – trap