开发者

What practice to use for HTML5 scoped attribute

I went to validate my HTML5 page today using the w3c validator and recieved an error message saying the style tag must have the scoped attribute if its not in the head section. So I added the scope attribute to my style tag and now I am getting thi开发者_StackOverflow中文版s warning from the validator,

The scoped attribute on the style element is not supported by browsers yet. It would probably be better to wait for implementations.

So which is it? Use the scoped attribute, or dont? If I do not then I am getting an error from the validator, if I do than I am getting a warning saying not to use it.


The validator will bitch at you if you have a style elem outside of the head. Scoping isnt supported and you should NOT do it for validation reasons, it has very explicit meanings in HTML5 and WebKit is soon landing support for it.

Browsers, on the other hand, don't give a shit about where your style elements are. So feel free to put them where you have to. (Assuming you have a good reason to put it outside of the head... which I'm curious about..)

Anyway, yet another example of how the validator does not reflect the reality of browsers. :)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜