title: CSS background image - shrink to fit fixed size div
body: <p>I have the following code at <a href="https://jsfiddle.net/ncrcfduz" rel="noreferrer">https://jsfiddle.net/ncrcfduz</a>, and a background image at <a href="https://s21.postimg.org/iq2mtjaiv/bg_boardwalk.jpg" rel="noreferrer">https://s21.postimg.org/iq2mtjaiv/bg_boardwalk.jpg</a>. I need to make the background image rescale to fit in the div, preferred to show most of the "centered" content in the image. The following code only show the top-left corner of the image.</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-css lang-css prettyprint-override"><code>.container {
    background: url(https://s21.postimg.org/iq2mtjaiv/bg_boardwalk.jpg) no-repeat fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    height: 150px;
    width: 300px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="container"&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>