在CSS中使用自定义(ttf)字体

编程入门 行业动态 更新时间:2024-10-25 20:23:17
本文介绍了在CSS中使用自定义(ttf)字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个mac,并且已经安装了一个名为7 Segment的字体(它显示在Font Book中)。当我使用 font-family:7 Segment; 我得到Helvetica(或类似)而不是浏览器的默认字体,但它仍然没有显示正确的字体。该页面只需要在此计算机上显示。我将如何使用此页面上的字体?感谢。

I have a mac, and have installed a font called "7 Segment" (it shows up in Font Book). When I use font-family: "7 Segment"; I get Helvetica (or similar) rather than the browser's default font, but it still isn't showing the correct font. The page only needs to be shown on this computer. How would I use the font on this page? Thanks.

推荐答案

您需要使用css-property font-face来声明您的字体。看看这个花哨的网站: www.font-face/

You need to use the css-property font-face to declare your font. Have a look at this fancy site: www.font-face/

例如:

@font-face { font-family: MyHelvetica; src: local("Helvetica Neue Bold"), local("HelveticaNeue-Bold"), url(MgOpenModernaBold.ttf); font-weight: bold; }

另请参阅: MDN @ font-face

更多推荐

在CSS中使用自定义(ttf)字体

本文发布于:2023-11-07 22:32:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1567617.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自定义   字体   CSS   ttf

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!