CSS 字体链接

发布于 2024-09-07 19:01:27 字数 225 浏览 0 评论 0原文

我在想如何将 css 中的 font-family 链接到文件夹中的字体。与 PHP 一样,您可以在文件夹中使用您的字体。
示例代码:

CSS:

font-family: verdana;

This is what I mean:

font-family: foldername/font

有相关代码吗?或者我必须使用PHP来浏览我自己的字体?

I was wandering how can I link font-family in css to a font in your folder. Like PHP you can use your font in your folder.
Example Code:

CSS:

font-family: verdana;

This is what I mean:

font-family: foldername/font

Is there a code for that? or I have to use PHP to browse my own font?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

凉风有信 2024-09-14 19:01:27
@font-face {
  font-family: "Kimberley";
  src: url(http://www.princexml.com/fonts/larabie/kimberle.ttf) format("truetype");
}

刚刚在“A List Apart”上找到了这个,还没有检查过自己,但这个网络专家是在线设计师最受尊敬的资源之一,所以我想你最好的机会就是尝试一下。

@font-face {
  font-family: "Kimberley";
  src: url(http://www.princexml.com/fonts/larabie/kimberle.ttf) format("truetype");
}

Just found this one on "A List Apart", haven't checked myself but this webbie is one of the most respectful resources for designers online so i guess your best shot is to give it a try.

篱下浅笙歌 2024-09-14 19:01:27

这是不可能的:

font-family: foldername/font

浏览器从客户端计算机的特定位置读取字体,您不能以这种方式更改它。

It is not possible do like:

font-family: foldername/font

Fonts are read by the browser from the client machine from a specific location, you can not change it that way.

恋竹姑娘 2024-09-14 19:01:27

约旦,
这应该可以帮助您:
使用@font-face

Jordan,
This should help you:
Using @font-face

§普罗旺斯的薰衣草 2024-09-14 19:01:27

你误解了这一点。 PHP 可以使用服务器端字体来生成图像。字体本身永远不会向客户端显示,而只是呈现的结果。

为了能够在用户的浏览器中使用非标准字体,您必须将字体与站点一起打包。

有多种技术可以做到这一点,所有技术都具有不同程度的浏览器支持。 此处这是一篇关于各种可用技术及其优点和缺点的好文章。另请查看重复链接

请注意,仅仅因为您购买了字体,这并不一定意味着您可以重新分发嵌入到网站中的字体! 请务必检查您的字体许可证。

You are misunderstanding this. PHP can use server-side fonts to generate an image. The font itself is never shown to the client, just the rendered results.

To be able to use a non-standard font in the user's browser, you will have to package the font along with the site.

There are various techniques to do this, all with various degrees of browser support. Here's a good article on the various available techniques, their upsides and downsides. Also check out the duplicate link.

Note that only because you paid for a font, this does not mean necessarily that you are allowed to re-distribute it embedded in a web site! Always check your font license.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文