我将如何使用自定义字体的CSS [英] How would I use custom fonts in CSS

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

问题描述

一些选项有什么我可以为了使用不被浏览器支持自定义字体试试?

What are some of the options I could try in order to use a custom font that is not supported by the browsers?

推荐答案

更​​新:截至2015年,最好的选择是使用CSS3字体面,它的字面支持几乎无处不在。有谷歌的字体平台上很好的例子。

UPDATE: As of 2015, the best option is to use CSS3 font-face, it's supported literally almost everywhere. There are good examples on the Google Fonts platform.

右键大概知道最好的选择是的Cufón: http://cufon.shoqolate.com/generate/

Right know probably the best option is cufon: http://cufon.shoqolate.com/generate/

这是一个JavaScript libary你的字体文件转换成他们的服务器在浏览器中这些字体的JavaScript的再presentation上。在所有主要浏览器上运行,看起来真的不错,不会减慢(如旧的基于闪存的解决方案sIFR那样),但确实需要的JavaScript。 (没有它,你仍然会看到所有的文本,但与标准字体)。

It is a JavaScript libary that converts your font file on their server to a JavaScript-representation of those fonts in the browser. Works in all major browsers, looks really nice, does not slow down (like the older flash-based sIFR solution), but does require JavaScript. (without it you will still see all the text but with standard font).

或者你可以使用CSS3字体面:的http:// randsco。 COM /的index.php / 2009/07/04 / P680
在这里你基本上把服务器上的字体,然后用CSS来呈现他们,简单明了。这是一个有点所有浏览器都支持的不好,但现在它可能是你最好的拍摄。不需要JavaScript。 (我知道我说的Cufón是你最好的拍摄,但是这两个都是一样的好,他们只是做了一点不同的方式)

Or you could use the CSS3 font-face: http://randsco.com/index.php/2009/07/04/p680 Where you basically put your fonts on the server and then use CSS to render them, plain and simple. It was a little badly supported by ALL browsers, but now it's probably your best shot. Does not require JavaScript. (I know I said cufon was your best shot, but those two are equally good, they just do it in a little different ways)

更新:此外,另一个原因字体面可能会更好的是,它使用的文​​本变得就像文档中的任何其他文本。 Cufoned文本成为在大多数浏览器的画布标记,并有与例如文本选择的问题。此外,如果你会一直在任何大数量的文本使用的Cufón(如整篇文章的文本,而不是只是它的标题),它可能会成为pretty慢(如JavaScript有渲染大量的文字在这种情况下)。标题都很好,虽然。

Update: Also, another reason why font-face might be better is that the text used with it becomes just like any other text in the document. Cufoned text becomes canvas tags in most browsers, and there are issues with for example text selection. Also, if you would've used cufon on any big amounts of text (like the text of the whole article, as opposed to just the heading of it), it would potentially become pretty slow (as JavaScript has to render a lot of text in that case). Headings are fine though.

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

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