简体   繁体   English

在CSS字体家族中使用继承是否安全

[英]Is it safe to use inherit in css font-family

I want to use a special font for some HTML element text. 我想对某些HTML元素文本使用特殊字体。 But I want to set parent font style when failed rendering special font on browser. 但是我想在浏览器上渲染特殊字体失败时设置父字体样式。

Example CSS code: CSS代码示例:

.SmoothText {
    font-family: "Special Font name", inherit;
}

Is it safe or not to mix font name and inherit ? 混合使用字体名称和inherit是否安全?

inherit can only exist by itself as a value for any property. inherit只能作为任何属性的值单独存在。 What you have is invalid. 您所拥有的是无效的。

If you want to add a font family to a parent font stack, you will need to specify the parent font stack again. 如果要将字体系列添加到父字体堆栈,则需要再次指定父字体堆栈。

inherit is a property value which means that property takes its value from its parent. inherit是属性值,表示属性从其父级获取其值。

IF you want to add font family to the parent ,font stack has your solution. 如果要将字体系列添加到父级,则字体堆栈具有您的解决方案。 See this Link 看到这个链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM