css - 如何为所有浏览器嵌入 ttf 格式的自定义网站字体?

标签 css fonts font-face truetype

在我的网站上,我使用的是我上传的自定义字体。好像是在选择什么时候断断续续的工作。它适用于某些计算机/浏览器,但不适用于其他计算机。它也被正确映射。

这是我的代码:

<style type="text/css">
@font-face {
    font-family: 'AgencyFBRegular';
    src: url('agencyr.eot');
    src: url('agencyr.eot?#iefix') format('embedded-opentype'),
         url('agencyr.woff') format('woff'),
         url('AGENCYR.TTF') format('truetype'),
         url('agencyr.svg#AgencyFBRegular') format('svg');
}


h3 {    font-family: 'Agency FB', sans-serif; font-size: 26px; font-weight:normal; text-align: left; line-height: 100%;
    border-bottom: 1px solid #484848; padding-bottom: 5px; margin-bottom:7px; 
</style>

在我用 friend 的笔记本电脑查看它之前,我认为它无处不在。

你能看出我哪里错了吗?

更新: 我更新了字体 CSS。它似乎可以工作,但现在不适用于 iOS。

最佳答案

下面的代码应该可以工作:

@font-face {
    font-family:"AgencyFBRegular";
    src: url("agencyr.eot") /* EOT file for IE */
}
@font-face {
    font-family:"AgencyFBRegular";
    src: url("agencyr.ttf") /* TTF file for CSS3 browsers */
}

h3 {
    font-family:'Agency FB', sans-serif;
    font-size: 26px;
    font-weight:normal;
    text-align: left;
    line-height: 100%;
    border-bottom: 1px solid #484848;
    padding-bottom: 5px;
    margin-bottom:7px;
}

关于css - 如何为所有浏览器嵌入 ttf 格式的自定义网站字体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16685979/

相关文章:

html - 如何在 div 中居中(背景)图像?

javascript - 在响应式 slider 中设置高度(jQuery Cycle)

html - 如何在英文网站上显示外语文字?

css - 不同字体的不同字体粗细

css - Wordpress floatbox 问题 IE

javascript - 在翻转时切换父元素的类

html - 带有 Trebuchet 字体的西类牙字符?

css - @fontface 适用于 http ://www. domain.com 但不适用于 http ://domain. com

css - @font-face 不显示在 Internet Explorer 上

css - @font-face 在 WordPress 主题中不起作用