我可以为同一种字体定义多个字体系列名称吗?

时间:2016-08-15 12:40:46

标签: html css fonts

我想知道我是否可以在CSS中为同一个字体(文件)定义多个font-family名称。

@font-face {
  font-family: 'Cool font';
  src: url('bumblebee-webfont.eot');
  src: local('☺'), 
       url('bumblebee-webfont.woff') format('woff'), 
       url('bumblebee-webfont.ttf') format('truetype'), 
       url('bumblebee-webfont.svg#webfontg8dbVmxj') format('svg');
}

@font-face {
  font-family: 'New font';
  src: url('bumblebee-webfont.eot');
  src: local('☺'), 
       url('bumblebee-webfont.woff') format('woff'), 
       url('bumblebee-webfont.ttf') format('truetype'), 
       url('bumblebee-webfont.svg#webfontg8dbVmxj') format('svg');
}

我想这样,因为同一字体有多个名称用法。它应该是下面的文字具有相同的字体:

<h2 style="font-family:'Cool font';">Hello</h2>
<h2 style="font-family:'New font';">Bye</h2>

这可能吗?

1 个答案:

答案 0 :(得分:1)

是的,你可以这样做。

因为font-family是关键,并且您可以设置多个font face具有不同的名称和相同的Font,但以这种方式使用它并不常见!!

相关问题