title: Adding images within Html.ActionLink
body: <p>I was trying to create an option to switch between a list view and widget view in ASP.net MVC (with razor view engine). </p>
  
  <p>However, I am having some trouble trying to both add an image, as well as scale it to the 'correct height' (the same height as the next next to it).</p>
  
  <p>I was looking to create something like:</p>
  
  <h1>Desired Result:</h1>
  
  <h1>---------------------------------------------------------------------------------</h1>
  
  <pre><code>[≡­] List View | [+] Widget View
  </code></pre>
  
  <h1>---------------------------------------------------------------------------------</h1>
  
  <p>where the <code>[≡]</code> and <code>[+]</code> were actually small icon images. </p>
  
  <p><strong>Attempts so far include:</strong></p>
  
  <p>The action link was something like:</p>
  
  <pre><code>@Html.ActionLink("List View", "listView",  
      new { @style = "background-image:url('~/Content/Images/listIcon.png')" },null)
  </code></pre>
  
  <p>which only displayed the text.</p>
  
  <p>I also tried creating the actionlink like:</p>
  
  <pre><code>&lt;img src="~/Content/Images/listIcon.png" /&gt;@Html.ActionLink("List View", "Index")
  </code></pre>
  
  <p>but this resolved in </p>
  
  <p>a) the image wasn't part of the link; and </p>
  
  <p>b) the image was almost twice the size of the text (similar to diagram below)</p>
  
  <pre><code> _    _               _    _
  |      |             |      |
  | icon |             | icon |
  |_    _| List View | |_    _| Widget View
  </code></pre>
  
  <p>I wouldn't even mind trying to create it like:</p>
  
  <h1>Alternative:</h1>
  
  <h1>---------------------------------------------------------------------------------</h1>
  
  <pre><code> _    _               _    _
  |      |             |      |
  | icon | List View | | icon | Widget View
  |_    _|             |_    _| 
  </code></pre>
  
  <p>if I <em>had</em> to.</p>
  
  <p>Would anyone know/advise how to solve/create this?</p>