New "use HTML5 semantic markup" option on File > New MVC 3 project

HtmlVisual Studio-2010asp.net Mvc-3Visual StudioTooling

Html Problem Overview


Some days ago I installed the ASP.NET MVC 3 Tools Update for Visual Studio 2010.

Just now I went to create a new ASP.NET MVC 3 application and I see that there's a new option on the New ASP.NET MVC 3 Project dialog:

> use HTML5 semantic markup

What does selecting this checkbox change in the newly created app compared to not selecting it, other than the literally obvious?
When would you definitely not want to use it, only to keep compatibility with old browsers?

Html Solutions


Solution 1 - Html

Look at the _Layout.cshtml. You will notice HTML5 tags such as <header> and <section>. It also includes the modernizr javascript plugin to the project.

> When would you definitely not want to use it, only to keep compatibility with old browsers?

If you don't want to use HTML5 specific tags. Anyway, it's just a checkbox generating a bunch of default markup that you could modify at any moment if you will. So you are not engaging yourself with anything that cannot be undone subsequently. If you are starting a new project, go ahead and check it :-)

Solution 2 - Html

The answer somewhat depends on which project template you select. (Empty, Internet Application, or Intranet Application)

If you select Empty, the checkbox adds the following two lines to the <head> section in your _Layout.cshtml.

<meta charset="utf-8" />
<script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")"
    type="text/javascript"></script>

If you select Internet or Intranet Application, then in addition to the two lines above, you will see HTML5 semantic markup tags instead of divs in your _Layout.cshtml markup shown below:

HTML5 Box Checked vs. Not Checked

<header>              <div id="header">
<nav>                 <div id="menucontainer">
<section id="main">   <div id="main">
<footer>              <div id="footer">

I see no reason not to check it, but it does not really matter. As mentioned by Darin, the checkbox value is just for determining which markup is generated for you. The value is not stored in your project.

You can read more in Scott Gu's blog post:HTML5 Improvements with the ASP.NET MVC 3 Tools Update

Solution 3 - Html

The check box dictates the inclusion of Modernizr with your views, I don't believe there is anything else different than when not checked.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSergi PapaseitView Question on Stackoverflow
Solution 1 - HtmlDarin DimitrovView Answer on Stackoverflow
Solution 2 - HtmlJames LawrukView Answer on Stackoverflow
Solution 3 - HtmlKris IvanovView Answer on Stackoverflow