在css中使用自定义字体时出错 [英] Error while using the custom fonts in css

查看:151
本文介绍了在css中使用自定义字体时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然我尝试通过CSS文件为我的网站使用自定义字体,但我没有得到所需的字体,它只显示默认字体。请检查css代码,并让我知道是否需要更改:)

While I tried to use custom font for my website through the CSS file, I'm not getting the required font and it shows only the default font. Please Check the css code and let me know if any changes needed :)

@font-face {
    font-family: Myriad Pro;
    src: url('Myriad.ttf');
    }
#voicetext{
    color:#127bb9;
    font-size:16px;
    font-family:"Myriad Pro";
    text-align:center;
    letter-spacing:3px;
}


推荐答案

这是直接的。对于真正的跨浏览器解决方案,您需要参考的不仅仅是TTF版本。

Unfortunately, it isn't as straight forward as this. For a truly cross-browser solution, you will need to reference more than just the TTF version.

此问题:如何在HTML中嵌入字体?有一个完整的列表,并链接到Paul Irish的Bulletproof web fonts博客条目,适合所有浏览器的问题。

This question: How to embed fonts in HTML? has a full list, and links to Paul Irish's "Bulletproof web fonts" blog entry that caters for all the browser quirks.

如果你匆忙,对细节不感兴趣,FontSquirrel的 Bulletproof @ font-面部生成器似乎利用了博客文章的提示。

If you're in a hurry, and not interested in the specifics, FontSquirrel's Bulletproof @font-face generator seems to utilize the hints from the blog post.

这篇关于在css中使用自定义字体时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆