gpt4 book ai didi

html - Universe 55 字体的@font-face 规则不起作用

转载 作者:太空宇宙 更新时间:2023-11-04 04:28:57 25 4
gpt4 key购买 nike

在 html5 中,我使用了自定义字体(Universe 55 字体)。我下载了 .ttf 文件,使用 @font-face 规则并使用 IE、Chrome、移动浏览器进行检查。它不起作用,但在网站上他们说浏览器将支持这种字体类型。我需要为字体使用任何其他文件格式吗?

我使用@font-face 规则作为,

@font-face
{ font-family: 'Universe2';
src: url("C:\Users\..\Desktop\Fonts\Univers LT 55 Roman.ttf"); }
.custfont
{ font-family: 'Universe2';
font-size:25px; }
<body><div class='custfont'>This is a customized font</div></body>

最佳答案

你必须通过元素链接它,例如你的元素位于 d:/projectname 里面你有字体文件,你可以像这样在 CSS 中链接它:

@font-face {
font-family: 'MyFont';
src: url('myfont.eot'); /* IE9 Compat Modes */
src: url('myfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('myfont.woff') format('woff'), /* Modern Browsers */
url('myfont.ttf') format('truetype'), /* Safari, Android, iOS */
url('myfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}

关于html - Universe 55 字体的@font-face 规则不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17695196/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com