title: i want to align this image to center but it's not working
body: <p>In the above code I used <code>margin-left: auto</code> and <code>margin-right: auto</code> properties to align the image to center. I want to align this image to center but it's not working.</p>
  
  <ul>
  <li>What is wrong with this code? </li>
  <li>Are there any alternative methods?</li>
  </ul>
  
  <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>#boom{
    margin-top: 30%;
    height: 4%;
    width: 50%;
    margin-left: auto;
    margin-right: auto;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;img src="image1.jpg" id="boom"&gt;</code></pre>
  </div>
  </div>
  </p>