title: Insert image to DOM resized to 50% of its width/height
body: <p>So I am trying to insert an image to a page with JavaScript with 50% of its width and 50% of its height.</p>
  
  <p>I do this:</p>
  
  <pre><code>someElement.html('&lt;img src="/path/to/img.jpg" alt="" class="sImg" /&gt;');
  </code></pre>
  
  <p>The sImg class is defined in stylesheet like this:</p>
  
  <pre><code>.sImg{
      border: 0;
      width: 50%;
      height: 50%;
  }
  </code></pre>
  
  <p>Yet the image appears fullsize.</p>
  
  <p>I have also checked via Firebug and the image has width and height both at 50%.</p>