Adding HTML5 markup to a MVC3 site

Problem

I have already created a MVC3 site but when I did I didn't select the HTML5 markup option. I would like to add some 'safe' HTML5 markup into the MVC3 site unless there is a way to convert the project to use HTML as if I had selected it from the start (is that possible?).

Would I be safe changing the _layout.cshtml to use HTML5 markup such as nav? How do I use my current CSS style sheet to make sure it positions it correctly (is it as simple as adding the class)?

I understand you can select the 'Target Schema For Validation' option to HTML5. Is that mainly for intellisense? Is this one of the primary bi-products of selecting the HTML5 option at project creation time or are there many more impacts other then this target schema and the _layout page?

Thanks much in advance!

Problem courtesy of: likestoski

Solution

There is no magic to the HTML5 support in MVC3. The checkbox in the project template dialog simply creates a different _layout file with <nav> instead of <div>, a reference to modernizr.js, etc. You're free to change the markup of the _layout file to whatever you like.

The schema validation dropdown simply governs what code completion options you get from Intellisense, and what warnings you get when adding markup that does not conform to the schema. But again, if the HTML5 standard gets updated with new tag next week, and Microsoft fails to update Visual Studio, you're free to add markup that doesn't conform to the VS schema.

Solution courtesy of: Jonas H

Discussion

There is currently no discussion for this recipe.

This recipe can be found in it's original form on Stack Over Flow.