是否有可能创建一个选择器来识别具有特定HTML font-weight属性的元素?
类似于(虚假示例):
div[font-weight^='900']{
font-family:"HaasGrotDisp55Roman";
}
div[font-weight^='500']{
font-family:"HaasGrotDisp35Thin";
}
使用font-face的CSS定义如下:
@font-face {
font-family: 'HaasGrotDisp35Thin';
src: url('fonts/neuehaasgrotdisp-35thin.eot');
}
@font-face {
font-family: 'HaasGrotDisp55Roman';
src: url('fonts/neuehaasgrotdisp-55roman.eot');
}
window.getComputedStyle()
函数。 - David Thomasfont-weight
属性,所以不行。 - BoltClock