Good evening to everyone
This is my client’s website url: https://www.cp-engineering.gr/
I’ve built it with North theme and I am trying to validate it via W3 Validator. However, I am getting an error with the following details:
Element style not allowed as child of element body in this context. (Suppressing further errors from this subtree.) From line 496, column 17; to line 497, column 61 <style type="text/css" media="all" id="siteorigin-panels-layouts-footer">/* Contexts in which element style may be used: Where metadata content is expected. In a noscript element that is a child of a head element. Content model for element body: Flow content.
In the footer section, I am using a Layout Builder widget. If I remove it from the footer, there is no error after validation.
So my question, is there any other way to “fix” this error by not removing the entire widget from the footer?
Thank you in advance
Hi Lmk83,
The element is allowed to be added to both the <head> and the <body>. For information on the style element, please click here. Unfortunately, the W3 Validator is very outdated so it’ll flag things that are allowed as being invalid due to the outdated rules it follows. I recommend against using it as no major search engine relies on the same testing methodology.
With that said, to your question, no. There’s no direct way to move the style element elsewhere on the page. You might be able to use a minify plugin that will move this element, but for performance reasons, they’re likely to add the CSS in the same place.
Hi Alex S,
thank you for your immediate response. I already know that these ‘tools’ are obselete, although some agencies use them for accessibility purposes only.
I followed your advice, cleared cache memory and I installed a minify plugin (https://wordpress.org/plugins/autoptimize/) and these ‘errors’ are now valid…for now!
Consider this post closed!
Thank you and have a nice day!
Hi Costas,
It’s great to hear you were able to find a solution that worked for you! :)
Please feel free to open up another thread if anything else comes up. Have a good one mate.