The W3C Validator didn't always parse internal CSS. I know this because, just recently pages that used to have no errors nor warnings now have newly found CSS errors.
Hence, my question is: Does any ignore code exist for the W3C Validator, similar to
<!--googleoff: all--><!--googleon: all-->
for Google, to prevent W3C from parsing internal CSS?
Sample "Internal" CSS code:
<style>
@-ms-viewport
{
width:device-width;
}
button, input[type="button"], input[type="submit"], input[type="reset"]
{
padding-top:8px !important;
padding-right:14px !important;
padding-bottom:9px !important;
padding-left:14px !important;
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;
-moz-box-shadow:0px 1px 2px rgba(159,159,159,0.5);
-webkit-box-shadow:0px 1px 2px rgba(159,159,159,0.5);
-khtml-box-shadow:0px 1px 2px rgba(159,159,159,0.5);
box-shadow:0px 1px 2px rgba(159,159,159,0.5);
-webkit-border-radius:2px;
-moz-border-radius:2px;
-khtml-border-radius:2px;
border-radius:2px;
border-width:1px;
border-style:solid;
border-color:#BCBCBC;
background:#f0f0f0;
background:-moz-linear-gradient(top, #f0f0f0 0%, #E0E0E0 100%);
background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#f0f0f0), color-stop(100%,#E0E0E0));
background:-webkit-linear-gradient(top, #f0f0f0 0%,#E0E0E0 100%);
background:-o-linear-gradient(top, #f0f0f0 0%,#E0E0E0 100%);
background:-ms-linear-gradient(top, #f0f0f0 0%,#E0E0E0 100%);
background:linear-gradient(to bottom, #f0f0f0 0%,#E0E0E0 100%);
filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#f0f0f0', endColorstr='#E0E0E0',GradientType=0 );
color:#535353 !important;
font-size:0.928em !important;
font-weight:normal !important;
line-height:normal !important;
}
button:hover, input[type="button"]:hover, input[type="submit"]:hover, input[type="reset"]:hover, button:focus, input[type="button"]:focus, input[type="submit"]:focus, input[type="reset"]:focus
{
background:#f8f8f8;
background:-moz-linear-gradient(top, #f8f8f8 0%, #E1E1E1 100%);
background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#E1E1E1));
background:-webkit-linear-gradient(top, #f8f8f8 0%,#E1E1E1 100%);
background:-o-linear-gradient(top, #f8f8f8 0%,#E1E1E1 100%);
background:-ms-linear-gradient(top, #f8f8f8 0%,#E1E1E1 100%);
background:linear-gradient(to bottom, #f8f8f8 0%,#E1E1E1 100%);
filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#f8f8f8', endColorstr='#E1E1E1',GradientType=0 );
}
button:active, input[type="button"]:active, input[type="submit"]:active, input[type="reset"]:active
{
-moz-box-shadow:inset 0px 1px 2px rgba(205,205,205,1);
-webkit-box-shadow:inset 0px 1px 2px rgba(205,205,205,1);
-khtml-box-shadow:inset 0px 1px 2px rgba(205,205,205,1);
box-shadow:inset 0px 1px 2px rgba(205,205,205,1);
background:#E0E0E0;
text-decoration:none !important;
}
</style>
When checking a HTML5 document with https://validator.w3.org/, you’ll get redirected to https://validator.w3.org/nu/, so the latter is likely the validator you are using.
WHATWG’s HTML spec introduced this requirement for the content of a style
element:
The child text content of a
style
element must be that of a conformant style sheet.
This means: If you want to have a valid WHATWG-HTML document, your CSS in the style
element needs to be valid, too. This wasn’t the case previously.
However, W3C’s HTML spec doesn’t have this requirement for the style
element, as of 2017-12-26. Unless they add that requirement, too, W3C-HTML documents would still be valid even if they contain invalid CSS in style
elements. Then maybe the validator instance hosted by the W3C will disable this CSS checking feature.
(Some days ago, a user asked for a switch in the validator to disable checking the CSS. The maintainer "will look into this".)