Skip to content

HTML Validation Error: Element style not allowed as child of element body in this context #38917

@oldrup

Description

@oldrup

Description

Hey peeps

After upgrading to WordPress 5.9, my sites no longer HTML validate, but throws the validation error "Error: Element style not allowed as child of element body in this context"

image

For a more detailed error report, please see: https://validator.w3.org/nu/?showsource=yes&doc=https%3A%2F%2Fdev.oldrup.dk%2Fwp59%2Fsample-page%2F

These errors seem to be styling of blocks, given a dynamic .wp-container class, those being injected within the body tag:
image

These errors appear regardless of choice of theme.

Under WordPress 5.8 the sites validated flawlessly.

Could it be possible to store the styling in a CSS file instead, or somewhere else in the document, not provoking this error?

Please let me know if I can do anything to help troubleshooting this one.

Bjarne

Step-by-step reproduction instructions

To reproduce, create a new WP 5.9 installation, and validate the built-in sample page.

Test site available at: https://dev.oldrup.dk/wp59/sample-page/

Screenshots, screen recording, code snippet

No response

Environment info

WordPress 5.9. Any theme. No plugins.

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Type] EnhancementA suggestion for improvement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions