我想知道我是否可以在我的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>这个是可能的吗?
发布于 2016-08-15 21:12:06
是的,你可以做到。
因为font-family是关键,您可以设置许多具有不同名称和相同Font的font face,但以这种方式使用它并不常见!!
https://stackoverflow.com/questions/38955273
复制相似问题