title: Visual Studio HTML5 Validation: Element 'img' cannot be nested within element 'a'
body: <p>I've run into this curious validation error in Visual Studio 2010 with HTML5 validation selected:</p>
  
  <p><img src="https://i.stack.imgur.com/fOxKD.png" alt="Validation error"></p>
  
  <p>Is this a validation error (legitimate or a bug in Visual Studio) or am I missing something obvious and simple?</p>
  
  <hr>
  
  <p><strong>Edit:</strong> added relevant code.</p>
  
  <p>View <code>cshtml</code>:</p>
  
  <pre><code>@model My.Web.ViewModels.ListVideos
  
  @{
      ViewBag.Title = "All Videos";
  }
  
  @foreach (var item in Model.Videos) { 
      &lt;a href="@Url.Action("Play", "Player", new { videoId = item.VideoId })"&gt;
          &lt;img src="http://i2.ytimg.com/vi/@item.PublisherVideoId/default.jpg" alt="@item.Title" style="border: 0" /&gt;
      &lt;/a&gt;
  }
  </code></pre>
  
  <p><code>_Layout.cshtml</code>:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8" /&gt;
      &lt;title&gt;@ViewBag.Title&lt;/title&gt;
      &lt;link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" /&gt;
      &lt;script src="@Url.Content("~/Scripts/jquery-1.6.4.min.js")" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div class="page"&gt;
          &lt;header&gt;
              &lt;div id="title"&gt;
                  &lt;h1&gt;My Web&lt;/h1&gt;
              &lt;/div&gt;
              &lt;div id="logindisplay"&gt;
                  @Html.Partial("_LogOnPartial")
              &lt;/div&gt;
              &lt;nav&gt;
                  &lt;ul id="menu"&gt;
                      &lt;li&gt;@Html.ActionLink("Videos", "ListVideos", "Player")&lt;/li&gt;
                      &lt;li&gt;@Html.ActionLink("Dev", "Index", "Dev")&lt;/li&gt;
                  &lt;/ul&gt;
              &lt;/nav&gt;
          &lt;/header&gt;
          &lt;section id="main"&gt;
              @RenderBody()
          &lt;/section&gt;
          &lt;footer&gt;
          &lt;/footer&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>