网站上的书法字体
如果我想让一些文本以书法字体显示,我如何知道它将如何呈现在用户计算机上。我怎么知道那个人在计算机上有什么字体或者这很重要吗?有什么在CSS中做到这一点的好例子吗?
我最好在 Photoshop 中将一些东西放在一起并另存为图像吗?
if i want to have some text show up in a calligraphy font, how do i know how it will render of the users computer. How do i know what fonts that person has on the computer or does it matter? any good examples of doing this in css?
would i be better off putting something together in photoshop and saving as an image?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您使用不会经常更改的标题和精美页面元素的字体,我会使用 Photoshop 中的图像。
如果您想在文本主体中使用该字体,我建议在 css 中定义一个字体系列。如果您找到并下载的字体很可能最终用户不会拥有它,我会找到您想要在当前操作系统上使用的字体。如果它是系统字体或像 ms word 这样的主要软件应用程序附带的字体,那么它很有可能在最终用户的计算机上可用。一旦你找到了你想要使用的字体,我就会做一些研究,看看你是否能找到 mac 风格甚至 Unix 风格的类似字体。
使用您知道可以在任何人的计算机上使用的备份字体总是好的,浏览器会在列表中选择最适用的字体,从第一个规定的字体开始,直到找到匹配的字体。
If you are using the font for headings and fancy page elements that are not going to change often I would use an image from photoshop.
If you want to use the font for the main body of text I would suggest defining a font family in css. I would find the font you want to use on your current os if its a font you found and downloaded chances are the end user wont have it. If its a system font or a font that comes with a major software application like ms word there is a good chance it will be available on the end users machine. Once you have found the font you want to use I would then do a little research and see if you can find something similar in a mac flavour and even a Unix flavour.
Its always good to use a backup font that you know will work on anyone's machine the browser will select the most applicable in the list starting with the first font stated working its way until it finds a match.
您可以将 TTF 字体文件嵌入到 CSS 中。
一个很好的例子是 此处:
编辑:
注意:这仅适用于 Firefox,也可能适用于 Chrome。
Microsoft 发布了一份关于如何将字体嵌入网页的文档使用嵌入式 OpenType 格式。它涉及将字体转换为 EOT 文件,然后使用以下语法在样式表中引用它:(
这是从官方在线演示 此处)。
根据下面 Boldewyn 的回答,我敢打赌您也可以在
src:
参数中使用 TTF 文件。You can embed TTF font files into CSS.
A good example of it is here:
Edit:
Note: This will only work in Firefox, and possibly Chrome.
Microsoft has published a document about how to embed fonts into a web page using the Embedded OpenType format. It involves converting the font to a an EOT file and then referencing it in the stylesheet using the following syntax:
(This was pulled from an official online demo here).
Based on Boldewyn's answer below, I would bet that you could also use a TTF file in the
src:
parameter.我倾向于在我的个人网站上使用
@font-face
..但这取决于您这样做的目的。首先..问题。
这是静态文本还是我们正在谈论帖子标题等。
如果是静态文本(例如主标题),请搭配图像。
与图像相同的文本(seo)
和 css
h1 {background:url(/images/use-the-text-as-image-name-for-seo.png) 左上角无重复;宽度:100px; height:30px;} /* 宽度和高度为图像宽度/高度 /
h1 Strong {position:absolute;left:-8000px;}/ 确保文本不会显示在图像上,但不会出于搜索引擎优化/屏幕阅读器的目的而隐藏它 */
如果您正在谈论需要动态的东西,并且你需要的不仅仅是优雅的降级,请选择 sIFR。如果可以接受优雅的降级,请使用
@font-face
I tend to use
@font-face
on my personal websites.. but it depends on what you are doing it for.First.. the questions.
Is this static text or are we talking about post headlines etc.
If static text, like the main headline, go with an image.
<h1><strong>Same text as the image(seo)</strong></h1>
and in the css
h1 {background:url(/images/use-the-text-as-image-name-for-seo.png) no-repeat top left; width:100px; height:30px;} /* width and height being image width / height /
h1 strong {position:absolute;left:-8000px;}/ makes sure the text doesn't show up over the image, yet doesn't hide it for seo/screen reader purposes */
If you are talking about something that needs to be dynamic, and you need more than graceful degredation, go with sIFR. If graceful degredation is acceptable, go with
@font-face
要添加到
@font-face
支持者: Paul Irish 发布了此 CSS 声明的一个版本,适用于所有较新的浏览器以及低至 IE5.5 的所有 IE。但是,您需要 TTF 和 EOT 格式的字体才能使该技术发挥作用。如果您的字体许可证允许这样做,则有很多工具可以在格式之间来回转换。只要谷歌一下就可以了。
To add to the
@font-face
supporters: Paul Irish published a version of this CSS declaration, that works in all newer browsers plus all IEs down to IE5.5. However, you need the font as both TTF and EOT formats for this technique to work.If the license of your font allows this, there are lots of tools to convert back and forth between the formats. Just google for it.