c# - asp.net 添加新字体

标签 c# asp.net css fonts

我想从我的“样式”文件夹中添加一种新字体,类型为 .ttf 到页面。 将所有文本字体更改为该字体的 CSS 代码是什么?

我认为这只是语法问题,因为我知道这很好用:

body {font-family: verdana;}

那么基本上,如何将其指向我的字体文件?

最佳答案

我相信您正在寻找 font-face 支持的 src 属性。更多知识请见网址http://www.w3.org/TR/css3-webfonts/#src-desc

<style type="text/css">
@font-face {
    font-family: "The Example Font";
    src: url(http://www.examplefonts.com/example.ttf) format("truetype");
}
div.ExampleFont { 
    font-family: "The Example Font", Verdana;
}
</style>
<div class="ExampleFont ">I am using the Example Font</div>

关于c# - asp.net 添加新字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11674038/

相关文章:

c# - 为什么我的 Storboard 不显示?

c# - 使用c#在asp.net中动态创建网页

css - "the baseline of parent box"的定义是什么?

根据结果​​将反馈标签设置为红色或绿色

html - 在两个 ionic 形式元素之间创建换行符

c# - 安装 Visual Studio 11 beta 后,不再通过 Visual Studio 2010 执行测试

C# NAudio 获取音频文件持续时间/性能

c# - 单击一次部署后的通知图标设置

asp.net - 是否有任何 .NET 标准可以处理本地化并允许用户自定义文本?

c# - 列表框在 SelectedIndexChanged 事件上返回空字符串