& lt; style& gt;标签里面的任何元素仍然可以正常工作吗? [英] <style> tag inside any elements will still work?
问题描述
我看到这样的东西:
<div>
<style type="text/css">
...
</style>
</div>
这很奇怪,但仍然可以使用.
It's very strange,but still work.
这违反标准吗?
推荐答案
值得指出的是,尽管它是无效的HTML,但它也极为普遍,任何不支持它的浏览器都将无法正确呈现其中的很大一部分.网络.
It's worth pointing out that although it's invalid HTML, it's also extremely common, and any browser that didn't support it would fail to render properly a significant portion of the web.
尤其是混搭,需要使用此功能,HTML 5定义了< style scoped>处理这个用例. <样式范围>尽管这样定义的样式并不适用于整个文档,但仅适用于< style scoped>出现.
Mash-ups in particular, need use of this feature, and HTML 5 defines <style scoped> to deal with this use case. <style scoped> can appear in the body, though styles so defined do not apply to the whole document, only to the section in which <style scoped> appears.
警告:HTML 5是草稿,因此不能保证< style scoped>或任何其他尚未实现的HTML 5功能都将实现.
WARNING: HTML 5 is a draft, and there is no guarantee that <style scoped> or any other HTML 5 feature that is not already implemented will ever be implemented.
这篇关于& lt; style& gt;标签里面的任何元素仍然可以正常工作吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!