css - Visual Studio 不呈现@font-face,可能是相对路径问题?

标签 css windows visual-studio font-face

请有人用@font-face 帮我解决这个问题。我已经多次使用这种技术,但出于某种原因,我终生无法弄清楚为什么字体不呈现。

所以我在 Visual Studio 中有一个名为 Web.Ui.Store 的元素,其中包含两个重要的子目录。 1./Content/css/Typography.css 2./Content/font/UTILITY-webfont.eot (我有 FontSquirrel 提供的所有字体,但为了解释只是标记命名这个扩展。)

现在在 Typography.css 中我有这些代码行。

 @font-face {
font-family: 'UtilityBoldCondensed';
    src: url('file:///C:/dev/trunk/Source/Web.Ui.Store/Content/font/UTILITY-webfont.eot#iefix');
    src: url('file:///C:/dev/trunk/Source/Web.Ui.Store/Content/font/UTILITY-webfont.eot?') format('embedded-opentype'),
    url('file:///C:/dev/trunk/Source/Web.Ui.Store/Content/font/UTILITY-webfont.woff') format('woff'),
    url('file:///C:/dev/trunk/Source/Web.Ui.Store/Content/font/UTILITY-webfont.ttf') format('truetype'),
    url('file:///C:/dev/trunk/Source/Web.Ui.Store/Content/font/UTILITY-webfont.svg#UtilityBoldCondensed') format('svg');
font-weight: bold;
font-style: normal;
 }

 @font-face {
font-family: 'LeagueGothicRegular';
src: url('C:\dev\trunk\Source\Web.Ui.Store\Content\font\League_Gothic-webfont.eot');
src: url('C:\dev\trunk\Source\Web.Ui.Store\Content\font\League_Gothic-webfont.eot?#iefix') format('embedded-opentype'),
     url('C:\dev\trunk\Source\Web.Ui.Store\Content\font\League_Gothic-webfont.woff') format('woff'),
     url('C:\dev\trunk\Source\Web.Ui.Store\Content\font\League_Gothic-webfont.ttf') format('truetype'),
     url('C:\dev\trunk\Source\Web.Ui.Store\Content\font\League_Gothic-webfont.svg#LeagueGothicRegular') format('svg');
font-weight: normal;
font-style: normal;

 }

 .UtilityBoldCondensed { font-family: 'UtilityBoldCondensed', Arial, Sans-Serif; }
 .LeagueGothicRegular { font-family: 'LeagueGothicRegular', Arial, Sans-Serif; }

我很困惑为什么我的“特殊”字体不会加载到我的元素中。我今天已经更改了很多次相对路径,但仍然无法渲染它。我已将问题缩小为文件位置的相对路径问题。有人可以帮助确定这是否正确。

最佳答案

正如我在谷歌的网络字体上看到的那样; @font-face 总是在 @media 屏幕内 {}...

检查一下:
http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic

关于css - Visual Studio 不呈现@font-face,可能是相对路径问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7152568/

相关文章:

visual-studio - 还原NuGet软件包时,在TFS Build 2015中“无法找到版本”

php - 我如何让用户能够在他们的个人资料上使用自定义 CSS?

html - 在包含元素之外显示文本

windows - 使用单个工作副本进行跨平台开发

windows - 使用 Powershell [DateTime]::ParseExact - 有趣的字符串?

.net - 我可以使用什么软件或服务以编程方式调用电话?

visual-studio - 如何在调试时禁用 Visual Studio 2010 窗口更改

visual-studio - 在 Visual Studio 的 Watch 窗口中是否有计算表达式的键盘快捷键?

javascript - 当我将鼠标悬停在图像上时如何显示虚拟箭头

javascript - 摆脱联系人表单中的灰色字体和文本框边框