W3C HTML 验证器不再接受作用域样式
W3C HTML validator no longer accepts scoped styles
几个月前,以下代码用于在 W3C 上验证 OK:
<!DOCTYPE html>
<html>
<head><title>Page Title</title></head>
<body>
<style type="text/css" scoped></style>
test content
</body>
</html>
当前验证器抛出:
Element style
not allowed as child of element body
in this context.
有什么解决办法吗?
作用域样式已从 HTML 中删除。
它们没有出现在 HTML 5 or HTML 5.1, and have been removed from Living HTML. (You can find a spec for them in a draft of HTML 5.1 但它没有进入最终版本。
Browser support is dying、Chrome 删除 对它们的支持,目前只有 Firefox 支持它们。
验证器将它们报告为错误,因为它们现在是错误。停止使用它们。
几个月前,以下代码用于在 W3C 上验证 OK:
<!DOCTYPE html>
<html>
<head><title>Page Title</title></head>
<body>
<style type="text/css" scoped></style>
test content
</body>
</html>
当前验证器抛出:
Element
style
not allowed as child of elementbody
in this context.
有什么解决办法吗?
作用域样式已从 HTML 中删除。
它们没有出现在 HTML 5 or HTML 5.1, and have been removed from Living HTML. (You can find a spec for them in a draft of HTML 5.1 但它没有进入最终版本。
Browser support is dying、Chrome 删除 对它们的支持,目前只有 Firefox 支持它们。
验证器将它们报告为错误,因为它们现在是错误。停止使用它们。