title: How to display multiple divs, inline within a container without fixed width?
body: <p>I'm working on a navigation bar that needs to display multiple divs side by side. But the parent div doesn't have a fixed width. Just some padding. So the question is how can I achieve this? </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.nav {
    width: 100%;
    height: 50px;
  }
  
  .nav ul {
    width: 100%;
    height: 50px;
  }
  
  .nav ul li {
    display: inline;
    list-style-type: none;
    background: gray;
    padding: 10px 30px;
    margin: 0 10px;
    height: 100%;
    position: relative;
  }
  
  #container {
    position: absolute;
    left: 0;
    top: 100%;
    background: black;
    padding: 10px;
  }
  
  #container .category {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 80px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="nav"&gt;
    &lt;ul&gt;
      &lt;li&gt;AB
        &lt;div id="container"&gt;
          &lt;div class="category" style="background: #4285f4;"&gt;&lt;/div&gt;
          &lt;div class="category" style="background: #ea4335;"&gt;&lt;/div&gt;
          &lt;div class="category" style="background: #fbbc05;"&gt;&lt;/div&gt;
          &lt;div class="category" style="background: #34a853;"&gt;&lt;/div&gt;
        &lt;/div&gt;
      &lt;/li&gt;
      &lt;li&gt;CD&lt;/li&gt;
      &lt;li&gt;EF&lt;/li&gt;
      &lt;li&gt;GH&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Those four colored divs must be inline.</p>