nirmal
nirmal

Reputation: 2180

Not able to solve the style tag validation issue in body

I am getting the HTML validation error below:

Element style not allowed as child of element div in this context. (Suppressing further errors from this subtree.)

I have used the scoped attribute from HTML 5.1 on a style tag:

<style scoped>

Any idea what is the root cause?

Upvotes: 1

Views: 227

Answers (1)

Paul Sweatte
Paul Sweatte

Reputation: 24617

The root cause is this:

The scoped attribute has been removed from the specification after only limited and experimental adoption by Chrome and Firefox.

The browser support is as follows:

  • Supported in Chrome 20+ to 34 by enabling the "Enable " or "experimental WebKit features" flag in chrome://flags. Removed in Chrome 35+ due to code complexity.

  • Gecko 20 and later implement :scope pseudo-class, but the preference layout.css.scope-pseudo.enabled must be set to true. This is only the case by default in Nightly and Aurora test versions.

References

Upvotes: 2

Related Questions