title: div background smaller than its content with css (without specifying the width in % or px)
body: <p>This is what I have:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div style="width: 100%; background: red; text-align: center"&gt;
    &lt;img src="http://upload.wikimedia.org/wikipedia/commons/thumb/e/e5/Plain-M%26Ms-Pile.jpg/280px-Plain-M%26Ms-Pile.jpg" height="170" width="170" style="border-radius:700px; border: 10px solid white;"&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>This is what I want:</p>
  
  <p><a href="https://i.stack.imgur.com/fstkg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fstkg.png" alt="enter image description here"></a></p>
  
  <p>I've tried borders, inset shadow, and many other options in CSS but none of them seem to work for my purpose.</p>
  
  <p>Is there any way to make the div's background smaller than the contents WITHOUT having to specify its height?</p>