可以别名一个字体家庭/体重吗?
我正在一个项目中工作,其中字体系列被定义为内联样式,其中内置了加权细节,例如font-family:inter_700bold
是否有一种方法可以使CSS/HTML中的font中的别名。 -family:Inter_700bold
变为font-fomily:inter,font-jight:700
I'm working in a project where font families are defined inline style with weighting detail built into them, like font-family: Inter_700Bold
Is there a way to alias that in css/html where font-family: Inter_700Bold
becomes font-family: Inter,font-weight:700
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一种可能的解决方案可能是要使用您提到的内联样式定位元素的选择器,并将重量/实际字体应用于它们。
One possible solution could be to have a selector that targets elements by the inline style you mention, and apply the weight/actual font to them.
您不能在HTML/CSS中使用某种动态别名,您将需要某种预处理程序。
但是,在定义
@font-face
时,您定义了字体的本地页面别名:确保您需要将所有可能的组合定义为
@font-face
定义。You can't use some sort of dynamic aliases in html/css, you gonna need some kind of preprocessor for that.
But while defining a
@font-face
, you define a local page alias for the font:Sure you will need all possible combinations defined as such the
@font-face
definitions.