title: How to Autosize Column Width in .CSHTML?
body: <p>So in MVC I used the power of VS2013 to autogenerate a view off a list type which displays the list of objects and its properties in array format using foreach. How can modify the code to auto-size the column widths to fit?</p>
  
  <pre><code>&lt;table class="table"&gt;
      &lt;tr&gt;
          &lt;th align="center"&gt;
              @Html.DisplayNameFor(model =&gt; model.IsoCode)
          &lt;/th&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.Name)
          &lt;/th&gt;
          &lt;th align="center"&gt;
              @Html.DisplayNameFor(model =&gt; model.Continent)
          &lt;/th&gt;
          &lt;th align="center"&gt;
              @Html.DisplayNameFor(model =&gt; model.CountryId)
          &lt;/th&gt;
          &lt;th align="center"&gt;
              @Html.DisplayNameFor(model =&gt; model.TotalLanguages)
          &lt;/th&gt;
          &lt;th&gt;&lt;/th&gt;
      &lt;/tr&gt;
  
  @foreach (var item in Model) {
      &lt;tr&gt;
          &lt;td align ="center"&gt;
              @Html.DisplayFor(modelItem =&gt; item.IsoCode)
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Name)
          &lt;/td&gt;
          &lt;td align ="center"&gt;
              @Html.DisplayFor(modelItem =&gt; item.Continent)
          &lt;/td&gt;
          &lt;td align ="center"&gt;
              @Html.DisplayFor(modelItem =&gt; item.CountryId)
          &lt;/td&gt;
          &lt;td align ="center"&gt;
              @Html.DisplayFor(modelItem =&gt; item.TotalLanguages)
          &lt;/td&gt;
          &lt;td&gt;
              @*@Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |*@
              @Html.ActionLink("Details", "Details", new { id = item.CountryId })
              @*@Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })*@
          &lt;/td&gt;
      &lt;/tr&gt;
  }
  </code></pre>