Monday, June 4, 2012

XHTML 1.0 Transitional "element is not supported XHTML"

While working with MVC 3 or MVC 4 application, some of your HTML tags may be showing you a document validation warning message saying "Element section is not supported", etc.

First of all, be clear that this validation errors has nothing to do with how the page will be displayed or application will be executed. They will still be shown and executed  You may be even seeing them when you just create a new ASP.NET MVC 3/ MVC 4 project using built-in template, and without writing even single line of code.

This is actually because, they are all HTML 5 tags, and your IDE is not set to use HTML 5 standards.

In order to get rid of those validation warnings, you need to set your IDE to use HTML 5 standards for document validation.
In order to do that -

Make sure your document (_Layout) page is using following: (this is default in case of MVC 3 and MVC 4)

<!DOCTYPE html>

Once done, set your IDE to use HTML 5 standards by going through Tools >> Options menu, and below screen:

 Change the target to "HTML 5" and click OK, and you will see those validation warnings are disappeared.

6 comments:

Thanks for visiting my blog.
However, if this helped you in any way, please take a moment to write a comment.

Thanks
Nirman