Did you find this useful?
Socialize it today.


Validating HTML5 Documents

Monday, October 08, 2012

If you have been working with HTML for quite some time, you should recall that the earlier versions of HTML were not very strict with regard to coding. For example, HTML elements did not have to be closed, and uppercase characters were accepted in the HTML tags and attributes. With XHTML, coding standards are much more stricter, following the rules in XML syntax. HTML5 is no longer concerned with strict code style. You can use lowercase, uppercase, omit quotes on attribute values, leave HTML elements open, and your page will likely still be valid. HTML5 pages will generally not validate due to the incorrect use of elements, missing required attributes, and incorrect attribute values. However, since many seasoned web developers are accustomed to the stricter validation rules imposed on XHTML documents, it is suggested that you continue to follow many of the XHTML syntax requirements. Your HTML5 code will be well organized, easier to read, and likely to contain less errors. In any event, here is a list of some of the practices that are now once again allowed when writing HTML5 markup.

  • Void elements, such as the input or image elements (elements that do not contain any content), are not required to be closed using a closing slash.
  • Elements and attributes can be in uppercase, lowercase, or mixed case.
  • Quotes are unnecessary around attribute values, unless multiple values are used
  • The link and script element no longer requires the "type" attribute in HTML5
  • Some elements that were deprecated are now valid
  • Stray text that does not appear inside any element is allowed
  • The form element is not required to have an action attribute.
  • Block elements such as <p> can be placed inside <a> elements.

So even though the flexibility has be included with HTML5, you are encouraged to be consistent in the style you choose. Following a standard will only make it easier for you to develop code and maintain it throughout the web application's life cycle.

HTML5 Validators

At the time of writing this tutorial HTML5 is very much in initial stage and there are only few validators available on the Internet. Here is a list of some HTML5 Validators that you can use to validate your documents.

  1. W3C Markup Validation Service

    The W3C Markup Validator checks the markup validity of HTML including HTML and XHTML as well as other types of documents.


    w3c validator

  2. Validator.nu (X)HTML5 Validator

    Here is another HTML5 Validator.


    nu validator


Keep in mind that as of the time of this writing HTML5 is still a work in progress. As HTML becomes closer to being a standard, these validators will most likely be updated as the standard process progresses.

Please help us spread the word by socializing it today!

email contact us

Did you find something wrong with the information on this page? Please take a moment to report it to us so that we can continue to improve the quality of the information on this site. Click here to report an issue with this page.



Recommended Books & Training Resources

The Definitive Guide to HTML5 HTML5: The Missing Manual HTML CSS and JavaScript