WordPress themes are usually either XHTML 1.0 Transitional or XHTML 1.0 Strict. The first line of the generated web page has the Document Type Definition (DTD) sent to the browser to define which.
My main theme that I use FastTrack, was defined as transitional. Just for kicks I changed it to strict and figured I would use the W3C validation service to identify what needed to be changed to make it validate.
I did not have to change much. The built in TinyMCE editor produces img tags that are not XHTML 1.0 Strict compliant. For example an image will have the tag defined as
<img src=”http://blog.dembowski.net/wp-content/costco-harmony-720.jpg” title=”Logitech Harmony 720″ alt=”Logitech Harmony 720″ align=”right” hspace=”5″ vspace=”5″ />
The attributes align, hspace, and vspace are valid XHTML 1.0 Transitional but not strict.
In order to make it valid for strict I had to lose those attributes. In strict this is valid:
<img src=”http://blog.dembowski.net/wp-content/costco-harmony-720.jpg” style=”margin: 5px; float: right” title=”Logitech Harmony 720″ alt=”Logitech Harmony 720″ />
The align attribute is not valid for <p> tag either, this requires another replacement with a style= statement.
In the theme I replaced one that was using <p align=”center”> with <p style=”text-align: center”>.
The last thing was to change strike through and underline. I used to put in the post via the code tab <strike>text</strike> which is not valid in strict. Neither is <u>underline</u>. I replaced that with <del>text</del> to have a line through the text and <ins>text</ins> to get underline.
I’m not particularly concerned about XHTML compliance. This and playing with CSS entries is just part of my learning and understanding how this all works.
Like this:
Like Loading...