基于条件的字体系列选择可用性

时间:2021-11-27 23:08:01

I would like to write css or some thing that it will make font-family dynamic like on user side if user has Helvetica text available then font-family will be Helvetica if not then font-family will be Arial, How to do this?

我想编写css或者某些东西,如果用户有Helvetica文本可以使字体系列像用户那样动态,那么font-family将是Helvetica,如果没有那么font-family将是Arial,怎么做?

Thanks in advance

提前致谢

1 个解决方案

#1


3  

The typical way is to add them all (most specific to most generic) as a comma delimited list in your style rule. If the first one is unavailable, the second is used, and if not that one, the third, etc.

典型的方法是将它们全部(最特定于大多数通用)添加为样式规则中的逗号分隔列表。如果第一个不可用,则使用第二个,如果不是,则使用第三个,等等。

font-family: Helvetica, Arial, sans-serif;

#1


3  

The typical way is to add them all (most specific to most generic) as a comma delimited list in your style rule. If the first one is unavailable, the second is used, and if not that one, the third, etc.

典型的方法是将它们全部(最特定于大多数通用)添加为样式规则中的逗号分隔列表。如果第一个不可用,则使用第二个,如果不是,则使用第三个,等等。

font-family: Helvetica, Arial, sans-serif;