If you are like me, you try very hard to produce W3C-valid XHTML and CSS code for your WordPress blog. I validate all of my XHTML and CSS code through the W3C Markup Validator Service and do my best to make sure it passes-in the green. However, sometimes there might be good reasons for accepting an error or two.
WordPress developers are very often on the leading edge in producing blogs that are both attractive and usable. In order to do this, they may knowingly use code that will not pass validation at W3C. Coding for WAI-ARIA, the Web Accessibility Initiative for Accessible Rich Internet Applications suite, is a case in point.
My blog theme is based on the WordPress default, Kubrick. I elected to allow comments on my blog. Because of this, ARIA-related code in the theme's comments.php file will generate XHTML code that will produce one validation error at W3C.
CSS code that anticipates future acceptance by W3C can also cause validation errors. Even so, if a browser recognizes the code, the styling will be applied; otherwise, the styling will be ignored.
Here is some CSS code in my theme's default style.css file that will generate errors at W3C:
Such CSS code in a plugin's stylesheet can also cause validation errors. Sociable, a popular WordPress plugin, is an example of this. The settings for Sociable include a check box to use, or not to use, the plugin's stylesheet. Using the plugin's stylesheet will generate CSS validation errors at W3C. If you do not elect to use the stylesheet, Sociable arranges the social-bookmark icons in a list, and this configuration does not cause the validation errors. However, you just might prefer to use the plugin's styling even if some validation errors occur at W3C.
When developers endeavor to maximize both the usability and the appearance of a WordPress blog, XHTML code can sometimes be generated that will show validation errors at W3C. Some of this code will, sooner or later, become part of the standard and pass "in the green" at W3C. The "offending" CSS and PHP code that causes the errors can be removed, but to do so might degrade the appearance or usability of the blog.
I hope this short article helps you to understand why it might sometimes be acceptable to ignore some W3C validation errors.
Here are the links for more information about WAI-ARIA and for the W3C markup validation Service:
- W3C Markup Validation Service