C# 向VS 2010@fontface添加自定义字体

C# 向VS 2010@fontface添加自定义字体,c#,asp.net,fonts,font-face,webfonts,C#,Asp.net,Fonts,Font Face,Webfonts,在VS2010中启动了一个新的asp.net网站(razor v2)网站(作为添加自定义字体的测试模板) 将字体“Gothic.TTd”作为“现有项”添加到项目级别。然后在“site.css”中我添加了 @font-face { font-family: "Century Gothic"; src: url('GOTHIC.TTF'), } 然后将此字体系列添加到site.css的“body”中,以查看其在主页上的外观: body { background-color:

在VS2010中启动了一个新的asp.net网站(razor v2)网站(作为添加自定义字体的测试模板)

将字体“Gothic.TTd”作为“现有项”添加到项目级别。然后在“site.css”中我添加了

@font-face
{
    font-family: "Century Gothic";
    src: url('GOTHIC.TTF'),
}
然后将此字体系列添加到site.css的“body”中,以查看其在主页上的外观:

body
{
    background-color: #fff;
    border-top: solid 10px #000;
    color: #333;
    font-size: .85em;
    font-family: "Century Gothic", Segoe UI, Verdana, Helvetica, Sans-Serif;
    margin: 0;
    padding: 0;
}
我还缺少什么,如何生成所需的css。?我正在学习以下教程:

有人能建议我现在能做什么吗?谢谢你的回复

更新 我补充说

<script type="text/javascript" src="GOTHIC.TTF"></script>

将逗号替换为分号,并删除字体系列名称中的空白

像这样:

@font-face
{
font-family: "CenturyGothic";
src: url('GOTHIC.TTF');
}

body
{
background-color: #fff;
border-top: solid 10px #000;
color: #333;
font-size: .85em;
font-family: "CenturyGothic", Segoe UI, Verdana, Helvetica, Sans-Serif;
margin: 0;
padding: 0;
}
添加其他URL将使您支持更多浏览器。ttf足以让它在Google Chrome中工作

更新

请在一个“standalone”.html文件中尝试,作为一种模板(它对我有用):


@字体
{
字体系列:“世纪”;
src:url('GOTHIC.TTF');
}
身体{
背景色:#fff;
边框顶部:实心10px#000;
颜色:#333;
字体大小:.85em;
字体系列:“世纪”,Segoe UI,Verdana,Helvetica,无衬线;
保证金:0;
填充:0;
}
你好,世界

如果这不起作用,也许你应该试试另一个.ttf。您可以在这里找到一个:

同时删除字体系列名称中的空白。我已经更新了答案。哦,好吧,我只需要它在谷歌chrome atm上工作。再次感谢您的帮助,但不幸的是,仍然没有删除layout.cshtml页面中的内容,并将“Century Gothic”的正文和“font face”分隔开……工作正常……再次感谢您的帮助
@font-face
{
font-family: "CenturyGothic";
src: url('GOTHIC.TTF');
}

body
{
background-color: #fff;
border-top: solid 10px #000;
color: #333;
font-size: .85em;
font-family: "CenturyGothic", Segoe UI, Verdana, Helvetica, Sans-Serif;
margin: 0;
padding: 0;
}
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style>
@font-face
{
font-family: "Century";
src: url('GOTHIC.TTF');
}
body {
background-color: #fff;
border-top: solid 10px #000;
color: #333;
font-size: .85em;
font-family: "Century", Segoe UI, Verdana, Helvetica, Sans-Serif;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>