title: How to center sub-item of drop-down menu to parent?
body: <p>I am trying to create a drop-down menu in which the children are center-aligned compared to the parent.</p>
  
  <p>I have already tried setting <code>margin: auto;</code> or setting <code>left: -50%; right: -50%</code> along with other solutions I found online, but nothing seems to work for me. </p>
  
  <p>How can I achieve that?</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>.header {
    /*background-image: url("../images/top_menu.png");*/
    width: 100%;
    background-repeat: no-repeat;
    background-position: left top;
    background-attachment: fixed;
    position: fixed;
    top: 0;
    background-origin: border-box;
    height: 68px;
  }
  
  ul {
    list-style-type: none;
    margin: 0;
    padding-left: 5%;
    padding-top: 15px;
    padding-bottom: 10px;
    overflow: hidden;
    display: inline-block;
  }
  
  li {
    float: left;
  }
  
  li a,
  .dropbtn {
    display: inline-block;
    color: #000;
    text-align: center;
    padding: 8px 10px;
    text-decoration: none;
    background-color: #fff;
    margin: 5px;
    border-radius: 30px;
    min-width: 160px;
  }
  
  li a:hover,
  .dropdown:hover .dropbtn {
    background-color: black;
    color: white;
  }
  
  li.dropdown {
    display: inline-block;
  }
  
  .dropdown-content {
    display: none;
    position: absolute;
    min-width: 160px;
    text-align: center;
  }
  
  .dropdown-content a {
    color: #e6e6e6;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: center;
    background-color: #333333;
  }
  
  .dropdown-content a:hover {
    background-color: #e6e6e6;
    color: #333333;
  }
  
  .dropdown:hover .dropdown-content {
    display: block;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="header"&gt;
    &lt;ul class="drop_menu"&gt;
      &lt;li class="dropdown"&gt;
        &lt;a href='#' class="dropbtn"&gt;Products&lt;/a&gt;
        &lt;div class="dropdown-content"&gt;
          &lt;a href='auto_tender_commercial.html'&gt;Link 1&lt;/a&gt;
          &lt;a href='fruit_series.html'&gt;Link 2&lt;/a&gt;
          &lt;a href='smart_sensors.html'&gt;Link 3&lt;/a&gt;
        &lt;/div&gt;
      &lt;/li&gt;
      &lt;li class="dropdown"&gt;
        &lt;a href='#' class="dropbtn"&gt;Bar Service Packages&lt;/a&gt;
        &lt;div class="dropdown-content"&gt;
          &lt;a href='what_is_it.html'&gt;Really long long long long long long long link&lt;/a&gt;
          &lt;a href='what_is_it.html'&gt;Link 4&lt;/a&gt;
          &lt;a href='leasing_plan.html'&gt;Link 5&lt;/a&gt;
        &lt;/div&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href='event_leasing.html'&gt;Event Leasing&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><a href="https://jsfiddle.net/pg60qetq/1/" rel="nofollow noreferrer">View on JSFiddle</a></p>