title: Make an image width 100% of parent div, but not bigger than its own width
body: <p>I’m trying to get an image (dynamically placed, with no restrictions on dimensions) to be as wide as its parent div, but only as long as that width isn’t wider than its own width at 100%. I’ve tried this, to no avail:</p>
  
  <pre><code>img {
      width: 100%;
      height: auto;
      max-width: 100%;
  }
  </code></pre>
  
  <p>Many of these images are way wider than their parent div, which is why I’d like them to resize accordingly, but when a small image pops in there and gets scaled up beyond its normal dimensions, it really looks terrible. Is there any way of doing this?</p>