开发者

Should inheritable CSS properties accept the value “initial”?

In Chrome and Safari, if we specify initial for an inheritable CSS property, it will select the initial value.

But if we specify initial for an inheritable CSS property in FireFox, IE, or Opera, it will reject that value assignment altogether.

Which is the correct behavior here?

Test script:

<!doctype html> 
<div style="color:red;">1111
    <div id="d2" style="color:blue;color:initial;">2222</div> 
</div> 
<script> 
document.write(document.getElementById("d2").style.color);
<开发者_开发问答/script> 


The initial value seems to be valid.

As CSS3 is (relatively) new and still prone to change, I suspect that not all browsers are up-to-date with the standardisation.

As stated by Paul D. Waite: it is part of the standard to have multiple definitions of the same property, of which the last one shoud win. So according to the standards your example, the color property of #d2 should have the initial value, which is red. Browsers which show the blue color do not support the standard completely/properly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜