title: How can I proportionally scale images to max-width?
body: <p>In a UIWebView, I am using the CSS max-width property to scale images of unknown size to fill a space no larger than (but perhaps smaller than) 300 pixels wide. Some of the original images are larger, and others are smaller.</p>
  
  <p>For now, I'm using the following CSS declaration, which scales the width correctly, but tends to blow out the height of larger images in the iOS WebView:</p>
  
  <pre><code> img{
      max-width:300px;
      margin:10px;
      padding:0px;
   }
  </code></pre>
  
  <p>So the question is: What's the correct way to ensure the height scales proportionally along with the width?</p>
  
  <p><em>(Edited headline and tags to generalize solution. Thanks, matt!)</em></p>