title: center image and keep same height
body: <p>how can i center image using css only within parent div without changing original size?</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>.main-img {
              display: block;
              width: 180px;
              overflow: hidden;
              align-self: flex-start;
          }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="main-img"&gt;
    &lt;img src="http://via.placeholder.com/300x50.png" width="1280px" height="550px" alt="main image" /&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>