https://developer.mozilla.org/en/CSS/inherit :
For non-inherited properties,
inherit
specifies a behavior that typically makes relatively little sense.
我想知道页面到底想表达什么。那么它是否告诉我们,当我们为非继承的属性执行 inherit
时,行为未标准化(可能有效也可能无效)?
因为我已经尝试在 FF、Chrome、IE、Safari 和 Opera 中为 border
设置 inherit
值并且它们都有效?
是否可以为所有非继承的 css 属性使用继承值?它们是 w3c 标准的一部分吗?
最佳答案
So is it telling us that when we do
inherit
for a property which is non-inherited, the behavior is not standardized (may and may not work) ?
它在除 IE < 8 之外的任何版本中都按预期工作,但为什么要让每个属性都继承
?如果为父元素 E
指定边框,则为 E *
指定 border: inherit
,然后 everything从 E
下降将获得相同的边界。
is it OK to use inherit value for ALL non-inherited css properties?
如果您真的希望某个元素从其父元素继承该样式,您可以为特定属性这样做,但是对于大多数设计来说,通常对每个属性,除非你的设计是专门用红色粗边框勾勒出每个矩形的轮廓。例如,看一下 this catastrophic mess of a page .
are they part of the w3c standard?
如果规范将 inherit
列为该属性的有效值,无论它是否“非继承”(这意味着它默认情况下不继承) ,那么它在技术上应该可以工作。
关于html - 可以为所有非继承的 css 属性使用继承值吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6973378/