我有一个 MVC4 4 Bootstrap 项目,它可以通过 Visual Studio 2010 在本地完美呈现,但是当我发布到用于 Intranet 的内部 IIS 时,我无法访问该资源http://fonts.googleapis.com/css?family=Montserrat:400
那么有人可以解释一下我如何本地化这个远程资源以便 IIS 在本地引用它。
任何帮助将非常感激 :-)
为了本地化 Google 字体,我添加了地址http://fonts.googleapis.com/css?family=Montserrat:400
进入我的浏览器地址栏,它返回一个 css 文件。
@font-face {
font-family: 'Montserrat';
font-style: normal;
font-weight: 400;
src: url(http://themes.googleusercontent.com/static/fonts/montserrat/v4/zhcz-_WihjSQC0oHJ9TCYFQlYEbsez9cZjKsNMjLOwM.eot);
src: local('Montserrat-Regular'), url(http://themes.googleusercontent.com/static/fonts/montserrat/v4/zhcz-_WihjSQC0oHJ9TCYFQlYEbsez9cZjKsNMjLOwM.eot) format('embedded-opentype'), url(http://themes.googleusercontent.com/static/fonts/montserrat/v4/zhcz-_WihjSQC0oHJ9TCYBsxEYwM7FgeyaSgU71cLG0.woff) format('woff');
}
然后,我将上述 css 中的每个 url 添加到地址栏中,该地址栏下载了关联的 .eot 和 .woff 文件。我只是用更符合逻辑的名称重命名了下载的文件,并将文件复制到 /Content/fonts 目录中。
然后,我将以下内容包含到我的 bootstrap.css 文件中。
@font-face {
font-family: 'Montserrat';
font-style: normal;
font-weight: 400;
src: url(fonts/montserrat-400.eot);
src: local('Montserrat-Regular'), url(fonts/montserrat-400.eot) format('embedded-opentype'), url(fonts/montserrat-400.woff) format('woff');
}
嘿,很快,所有字体都在内部 IIS 服务器上正确呈现。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)