在CSS中显示@font-face的替代字体
在 CSS 中使用 @font-face as 引入新字体
@font-face{
font-family:'myCustom';
font-style:normal;
font-weight:400;
src:local('myCustom'),
local('myCustom-Regular'),
url('myCustom.woff') format('woff')
}
并将字体定义为
font-family: myCustom, Tahoma, Verdana, cursive;
但是,我有两个问题:
在下载我的自定义字体之前,它不会显示第二个(替代字体),并且文本将为空白。
如果出于任何原因访问者浏览器没有下载我的自定义字体,它将不会显示任何文本。
在我的自定义字体可用之前,如何显示替代字体?
Introducing new font in CSS with @font-face as
@font-face{
font-family:'myCustom';
font-style:normal;
font-weight:400;
src:local('myCustom'),
local('myCustom-Regular'),
url('myCustom.woff') format('woff')
}
and defining the font as
font-family: myCustom, Tahoma, Verdana, cursive;
However, I have two problems:
Until download my custom font, it will not show the second (alternative font), and the text will be blank.
If for any reason the visitor browser does not download my custom font, it will not display any text.
How can I display the alternative font until availability of my custom font?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我期望发生的是,将使用
font-family
列表中列出的第一个可用的已安装字体。如果没有出现这种情况,请发布 URL 进行检查。但您可能希望考虑您使用的字体系列列表。如果
Tahoma
和Verdana
可以接受,那么cursive
就不会;在这种情况下,正常的通用后备字体将是sans-serif
。What I expect to happen is that the first available installed font, among those listed in the
font-family
list, will be used. If this does not happen, please post a URL for inspection.But you may wish to consider the list of font families you use. The odds are that if
Tahoma
andVerdana
would be acceptable,cursive
would not be; a normal generic fallback font in this case would besans-serif
.